mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-23 05:29:54 +01:00
Fix adding users
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
1d28cd5b9d
commit
e62aa00d5f
@ -27,6 +27,7 @@ import com.nextcloud.talk.newarch.domain.repository.offline.UsersRepository
|
|||||||
import com.nextcloud.talk.newarch.domain.usecases.*
|
import com.nextcloud.talk.newarch.domain.usecases.*
|
||||||
import com.nextcloud.talk.newarch.features.account.loginentry.LoginEntryViewModelFactory
|
import com.nextcloud.talk.newarch.features.account.loginentry.LoginEntryViewModelFactory
|
||||||
import com.nextcloud.talk.newarch.features.account.serverentry.ServerEntryViewModelFactory
|
import com.nextcloud.talk.newarch.features.account.serverentry.ServerEntryViewModelFactory
|
||||||
|
import com.nextcloud.talk.newarch.utils.NetworkComponents
|
||||||
import com.nextcloud.talk.utils.preferences.AppPreferences
|
import com.nextcloud.talk.utils.preferences.AppPreferences
|
||||||
import org.koin.android.ext.koin.androidApplication
|
import org.koin.android.ext.koin.androidApplication
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
@ -38,7 +39,7 @@ val AccountModule = module {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
factory {
|
factory {
|
||||||
createLoginEntryViewModelFactory(androidApplication(), get(), get(), get(), get(), get(), get(), get())
|
createLoginEntryViewModelFactory(androidApplication(), get(), get(), get())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,15 +54,11 @@ fun createServerEntryViewModelFactory(
|
|||||||
|
|
||||||
fun createLoginEntryViewModelFactory(
|
fun createLoginEntryViewModelFactory(
|
||||||
application: Application,
|
application: Application,
|
||||||
getProfileUseCase: GetProfileUseCase,
|
networkComponents: NetworkComponents,
|
||||||
getCapabilitiesUseCase: GetCapabilitiesUseCase,
|
|
||||||
getSignalingSettingsUseCase: GetSignalingSettingsUseCase,
|
|
||||||
registerPushWithServerUseCase: RegisterPushWithServerUseCase,
|
|
||||||
registerPushWithProxyUseCase: RegisterPushWithProxyUseCase,
|
|
||||||
appPreferences: AppPreferences,
|
appPreferences: AppPreferences,
|
||||||
usersRepository: UsersRepository
|
usersRepository: UsersRepository
|
||||||
): LoginEntryViewModelFactory {
|
): LoginEntryViewModelFactory {
|
||||||
return LoginEntryViewModelFactory(
|
return LoginEntryViewModelFactory(
|
||||||
application, getProfileUseCase, getCapabilitiesUseCase, getSignalingSettingsUseCase, registerPushWithServerUseCase, registerPushWithProxyUseCase, appPreferences, usersRepository
|
application, networkComponents, appPreferences, usersRepository
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -35,6 +35,7 @@ import com.nextcloud.talk.models.json.signaling.settings.SignalingSettingsOveral
|
|||||||
import com.nextcloud.talk.models.json.userprofile.UserProfileOverall
|
import com.nextcloud.talk.models.json.userprofile.UserProfileOverall
|
||||||
import com.nextcloud.talk.newarch.mvvm.BaseViewModel
|
import com.nextcloud.talk.newarch.mvvm.BaseViewModel
|
||||||
import com.nextcloud.talk.newarch.data.model.ErrorModel
|
import com.nextcloud.talk.newarch.data.model.ErrorModel
|
||||||
|
import com.nextcloud.talk.newarch.data.source.remote.ApiErrorHandler
|
||||||
import com.nextcloud.talk.newarch.domain.repository.offline.UsersRepository
|
import com.nextcloud.talk.newarch.domain.repository.offline.UsersRepository
|
||||||
import com.nextcloud.talk.newarch.domain.usecases.*
|
import com.nextcloud.talk.newarch.domain.usecases.*
|
||||||
import com.nextcloud.talk.newarch.domain.usecases.base.UseCaseResponse
|
import com.nextcloud.talk.newarch.domain.usecases.base.UseCaseResponse
|
||||||
@ -42,6 +43,7 @@ import com.nextcloud.talk.newarch.local.models.User
|
|||||||
import com.nextcloud.talk.newarch.local.models.other.UserStatus
|
import com.nextcloud.talk.newarch.local.models.other.UserStatus
|
||||||
import com.nextcloud.talk.newarch.local.models.toUser
|
import com.nextcloud.talk.newarch.local.models.toUser
|
||||||
import com.nextcloud.talk.newarch.local.models.toUserEntity
|
import com.nextcloud.talk.newarch.local.models.toUserEntity
|
||||||
|
import com.nextcloud.talk.newarch.utils.NetworkComponents
|
||||||
import com.nextcloud.talk.utils.PushUtils
|
import com.nextcloud.talk.utils.PushUtils
|
||||||
import com.nextcloud.talk.utils.preferences.AppPreferences
|
import com.nextcloud.talk.utils.preferences.AppPreferences
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@ -50,13 +52,9 @@ import kotlinx.coroutines.withContext
|
|||||||
import org.koin.core.parameter.parametersOf
|
import org.koin.core.parameter.parametersOf
|
||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
|
|
||||||
class LoginEntryViewModel constructor(
|
class LoginEntryViewModel(
|
||||||
application: Application,
|
application: Application,
|
||||||
private val getProfileUseCase: GetProfileUseCase,
|
private val networkComponents: NetworkComponents,
|
||||||
private val getCapabilitiesUseCase: GetCapabilitiesUseCase,
|
|
||||||
private val getSignalingSettingsUseCase: GetSignalingSettingsUseCase,
|
|
||||||
private val registerPushWithServerUseCase: RegisterPushWithServerUseCase,
|
|
||||||
private val registerPushWithProxyUseCase: RegisterPushWithProxyUseCase,
|
|
||||||
private val appPreferences: AppPreferences,
|
private val appPreferences: AppPreferences,
|
||||||
private val usersRepository: UsersRepository) :
|
private val usersRepository: UsersRepository) :
|
||||||
BaseViewModel<LoginEntryView>(application) {
|
BaseViewModel<LoginEntryView>(application) {
|
||||||
@ -131,9 +129,12 @@ class LoginEntryViewModel constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getProfile(loginData: LoginData) {
|
private fun getProfile(loginData: LoginData) {
|
||||||
|
user!!.id = -1
|
||||||
user!!.username = loginData.username!!
|
user!!.username = loginData.username!!
|
||||||
user!!.baseUrl = loginData.serverUrl!!
|
user!!.baseUrl = loginData.serverUrl!!
|
||||||
user!!.token = loginData.token
|
user!!.token = loginData.token
|
||||||
|
val repository = networkComponents.getRepository(false, user!!)
|
||||||
|
val getProfileUseCase = GetProfileUseCase(repository, ApiErrorHandler())
|
||||||
getProfileUseCase.invoke(viewModelScope, parametersOf(user!!.toUserEntity()), object : UseCaseResponse<UserProfileOverall> {
|
getProfileUseCase.invoke(viewModelScope, parametersOf(user!!.toUserEntity()), object : UseCaseResponse<UserProfileOverall> {
|
||||||
override suspend fun onSuccess(result: UserProfileOverall) {
|
override suspend fun onSuccess(result: UserProfileOverall) {
|
||||||
result.ocs.data.userId?.let { userId ->
|
result.ocs.data.userId?.let { userId ->
|
||||||
@ -152,6 +153,8 @@ class LoginEntryViewModel constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getCapabilities() {
|
private fun getCapabilities() {
|
||||||
|
val repository = networkComponents.getRepository(false, user!!)
|
||||||
|
val getCapabilitiesUseCase = GetCapabilitiesUseCase(repository, ApiErrorHandler())
|
||||||
getCapabilitiesUseCase.invoke(viewModelScope, parametersOf(user!!.baseUrl), object : UseCaseResponse<CapabilitiesOverall> {
|
getCapabilitiesUseCase.invoke(viewModelScope, parametersOf(user!!.baseUrl), object : UseCaseResponse<CapabilitiesOverall> {
|
||||||
override suspend fun onSuccess(result: CapabilitiesOverall) {
|
override suspend fun onSuccess(result: CapabilitiesOverall) {
|
||||||
user!!.capabilities = result.ocs.data.capabilities
|
user!!.capabilities = result.ocs.data.capabilities
|
||||||
@ -165,6 +168,8 @@ class LoginEntryViewModel constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getSignalingSettings() {
|
private fun getSignalingSettings() {
|
||||||
|
val repository = networkComponents.getRepository(false, user!!)
|
||||||
|
val getSignalingSettingsUseCase = GetSignalingSettingsUseCase(repository, ApiErrorHandler())
|
||||||
getSignalingSettingsUseCase.invoke(viewModelScope, parametersOf(user!!.toUserEntity()), object : UseCaseResponse<SignalingSettingsOverall> {
|
getSignalingSettingsUseCase.invoke(viewModelScope, parametersOf(user!!.toUserEntity()), object : UseCaseResponse<SignalingSettingsOverall> {
|
||||||
override suspend fun onSuccess(result: SignalingSettingsOverall) {
|
override suspend fun onSuccess(result: SignalingSettingsOverall) {
|
||||||
user!!.signalingSettings = result.ocs.signalingSettings
|
user!!.signalingSettings = result.ocs.signalingSettings
|
||||||
@ -200,6 +205,8 @@ class LoginEntryViewModel constructor(
|
|||||||
|
|
||||||
private fun registerForPushWithServer(token: String) {
|
private fun registerForPushWithServer(token: String) {
|
||||||
val options = PushUtils(usersRepository).getMapForPushRegistrationWithServer(context, token)
|
val options = PushUtils(usersRepository).getMapForPushRegistrationWithServer(context, token)
|
||||||
|
val repository = networkComponents.getRepository(false, user!!)
|
||||||
|
val registerPushWithServerUseCase = RegisterPushWithServerUseCase(repository, ApiErrorHandler())
|
||||||
registerPushWithServerUseCase.invoke(viewModelScope, parametersOf(user!!.toUserEntity(), options), object : UseCaseResponse<PushRegistrationOverall> {
|
registerPushWithServerUseCase.invoke(viewModelScope, parametersOf(user!!.toUserEntity(), options), object : UseCaseResponse<PushRegistrationOverall> {
|
||||||
override suspend fun onSuccess(result: PushRegistrationOverall) {
|
override suspend fun onSuccess(result: PushRegistrationOverall) {
|
||||||
user!!.pushConfiguration!!.deviceIdentifier = result.ocs.data.deviceIdentifier
|
user!!.pushConfiguration!!.deviceIdentifier = result.ocs.data.deviceIdentifier
|
||||||
@ -223,6 +230,9 @@ class LoginEntryViewModel constructor(
|
|||||||
val options = PushUtils(usersRepository).getMapForPushRegistrationWithServer(user!!.toUserEntity())
|
val options = PushUtils(usersRepository).getMapForPushRegistrationWithServer(user!!.toUserEntity())
|
||||||
|
|
||||||
if (options != null) {
|
if (options != null) {
|
||||||
|
val repository = networkComponents.getRepository(false, user!!)
|
||||||
|
val registerPushWithProxyUseCase = RegisterPushWithProxyUseCase(repository, ApiErrorHandler())
|
||||||
|
|
||||||
registerPushWithProxyUseCase.invoke(viewModelScope, parametersOf(user!!.toUserEntity(), options), object : UseCaseResponse<Any> {
|
registerPushWithProxyUseCase.invoke(viewModelScope, parametersOf(user!!.toUserEntity(), options), object : UseCaseResponse<Any> {
|
||||||
override suspend fun onSuccess(result: Any) {
|
override suspend fun onSuccess(result: Any) {
|
||||||
user!!.pushConfiguration!!.pushConfigurationStateWrapper = PushConfigurationStateWrapper(PushConfigurationState.PROXY_REGISTRATION_DONE, null)
|
user!!.pushConfiguration!!.pushConfigurationStateWrapper = PushConfigurationStateWrapper(PushConfigurationState.PROXY_REGISTRATION_DONE, null)
|
||||||
|
@ -27,10 +27,11 @@ import androidx.lifecycle.ViewModel
|
|||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import com.nextcloud.talk.newarch.domain.repository.offline.UsersRepository
|
import com.nextcloud.talk.newarch.domain.repository.offline.UsersRepository
|
||||||
import com.nextcloud.talk.newarch.domain.usecases.*
|
import com.nextcloud.talk.newarch.domain.usecases.*
|
||||||
|
import com.nextcloud.talk.newarch.utils.NetworkComponents
|
||||||
import com.nextcloud.talk.utils.preferences.AppPreferences
|
import com.nextcloud.talk.utils.preferences.AppPreferences
|
||||||
|
|
||||||
class LoginEntryViewModelFactory constructor(private val application: Application, private val getProfileUseCase: GetProfileUseCase, private val getCapabilitiesUseCase: GetCapabilitiesUseCase, private val getSignalingSettingsUseCase: GetSignalingSettingsUseCase, private val registerPushWithServerUseCase: RegisterPushWithServerUseCase, private val registerPushWithProxyUseCase: RegisterPushWithProxyUseCase, private val appPreferences: AppPreferences, private val usersRepository: UsersRepository) : ViewModelProvider.Factory {
|
class LoginEntryViewModelFactory constructor(private val application: Application, private val networkComponents: NetworkComponents, private val appPreferences: AppPreferences, private val usersRepository: UsersRepository) : ViewModelProvider.Factory {
|
||||||
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
|
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
|
||||||
return LoginEntryViewModel(application, getProfileUseCase, getCapabilitiesUseCase, getSignalingSettingsUseCase, registerPushWithServerUseCase, registerPushWithProxyUseCase, appPreferences, usersRepository) as T
|
return LoginEntryViewModel(application, networkComponents, appPreferences, usersRepository) as T
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ class ChatViewModel constructor(application: Application,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val sendChatMessageUseCase = SendChatMessageUseCase(networkComponents.getRepository(false, user), apiErrorHandler)
|
val sendChatMessageUseCase = SendChatMessageUseCase(networkComponents.getRepository(false, user), ApiErrorHandler())
|
||||||
// No reference id needed here
|
// No reference id needed here
|
||||||
initConversation?.let {
|
initConversation?.let {
|
||||||
sendChatMessageUseCase.invoke(viewModelScope, parametersOf(user, it.token, editable, replyTo, null), object : UseCaseResponse<Response<ChatOverall>> {
|
sendChatMessageUseCase.invoke(viewModelScope, parametersOf(user, it.token, editable, replyTo, null), object : UseCaseResponse<Response<ChatOverall>> {
|
||||||
@ -212,7 +212,7 @@ class ChatViewModel constructor(application: Application,
|
|||||||
|
|
||||||
private suspend fun pullPastMessagesForUserAndConversation(userNgEntity: UserNgEntity, conversation: Conversation) {
|
private suspend fun pullPastMessagesForUserAndConversation(userNgEntity: UserNgEntity, conversation: Conversation) {
|
||||||
if (userNgEntity.id == user.id && conversation.token == initConversation?.token && view != null) {
|
if (userNgEntity.id == user.id && conversation.token == initConversation?.token && view != null) {
|
||||||
val getChatMessagesUseCase = GetChatMessagesUseCase(networkComponents.getRepository(true, userNgEntity.toUser()), apiErrorHandler)
|
val getChatMessagesUseCase = GetChatMessagesUseCase(networkComponents.getRepository(true, userNgEntity.toUser()), ApiErrorHandler())
|
||||||
val lastReadMessageId = conversation.lastReadMessageId
|
val lastReadMessageId = conversation.lastReadMessageId
|
||||||
getChatMessagesUseCase.invoke(viewModelScope, parametersOf(user, conversation.token, 0, lastReadMessageId, 1), object : UseCaseResponse<Response<ChatOverall>> {
|
getChatMessagesUseCase.invoke(viewModelScope, parametersOf(user, conversation.token, 0, lastReadMessageId, 1), object : UseCaseResponse<Response<ChatOverall>> {
|
||||||
override suspend fun onSuccess(result: Response<ChatOverall>) {
|
override suspend fun onSuccess(result: Response<ChatOverall>) {
|
||||||
@ -243,7 +243,7 @@ class ChatViewModel constructor(application: Application,
|
|||||||
|
|
||||||
suspend fun pullFutureMessagesForUserAndConversation(userNgEntity: UserNgEntity, conversation: Conversation, lastGivenMessage: Int = 0) {
|
suspend fun pullFutureMessagesForUserAndConversation(userNgEntity: UserNgEntity, conversation: Conversation, lastGivenMessage: Int = 0) {
|
||||||
if (userNgEntity.id == user.id && conversation.token == initConversation?.token && view != null) {
|
if (userNgEntity.id == user.id && conversation.token == initConversation?.token && view != null) {
|
||||||
val getChatMessagesUseCase = GetChatMessagesUseCase(networkComponents.getRepository(true, userNgEntity.toUser()), apiErrorHandler)
|
val getChatMessagesUseCase = GetChatMessagesUseCase(networkComponents.getRepository(true, userNgEntity.toUser()), ApiErrorHandler())
|
||||||
var lastKnownMessageId = lastGivenMessage
|
var lastKnownMessageId = lastGivenMessage
|
||||||
if (lastGivenMessage == 0) {
|
if (lastGivenMessage == 0) {
|
||||||
lastKnownMessageId = conversation.lastReadMessageId.toInt()
|
lastKnownMessageId = conversation.lastReadMessageId.toInt()
|
||||||
|
@ -50,7 +50,9 @@ class SettingsViewFooterSource(private val context: Context) : FooterSource<User
|
|||||||
results.add(Data(user, context.resources.getString(R.string.nc_settings_new_account)))
|
results.add(Data(user, context.resources.getString(R.string.nc_settings_new_account)))
|
||||||
user
|
user
|
||||||
} else {
|
} else {
|
||||||
null
|
val user = User(-1, "-1", "-1", "")
|
||||||
|
results.add(Data(user, context.resources.getString(R.string.nc_settings_new_account)))
|
||||||
|
user
|
||||||
}
|
}
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
@ -30,7 +30,7 @@ import com.nextcloud.talk.newarch.local.models.User
|
|||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
abstract class MessagesDao {
|
abstract class MessagesDao {
|
||||||
@Query("SELECT * FROM messages WHERE conversation_id = :conversationId ORDER BY timestamp ASC")
|
@Query("SELECT * FROM messages WHERE conversation_id = :conversationId ORDER BY timestamp ASC, message_id ASC")
|
||||||
abstract fun getMessagesWithUserForConversation(conversationId: String):
|
abstract fun getMessagesWithUserForConversation(conversationId: String):
|
||||||
LiveData<List<MessageEntity>>
|
LiveData<List<MessageEntity>>
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ abstract class MessagesDao {
|
|||||||
)
|
)
|
||||||
abstract suspend fun updateMessageId(newId: String, conversationId: String, referenceId: String)
|
abstract suspend fun updateMessageId(newId: String, conversationId: String, referenceId: String)
|
||||||
|
|
||||||
@Query("SELECT * FROM messages WHERE conversation_id = :conversationId AND (message_id >= :messageId OR message_id = 0) ORDER BY timestamp ASC")
|
@Query("SELECT * FROM messages WHERE conversation_id = :conversationId AND (message_id >= :messageId OR message_id = 0) ORDER BY timestamp ASC, message_id ASC")
|
||||||
abstract fun getMessagesWithUserForConversationSince(conversationId: String, messageId: Long): LiveData<List<MessageEntity>>
|
abstract fun getMessagesWithUserForConversationSince(conversationId: String, messageId: Long): LiveData<List<MessageEntity>>
|
||||||
|
|
||||||
@Query("SELECT * FROM messages WHERE conversation_id = :conversationId AND message_id = :messageId")
|
@Query("SELECT * FROM messages WHERE conversation_id = :conversationId AND message_id = :messageId")
|
||||||
|
@ -111,7 +111,7 @@ class GlobalService constructor(usersRepository: UsersRepository,
|
|||||||
} else {
|
} else {
|
||||||
currentUser?.let { user ->
|
currentUser?.let { user ->
|
||||||
if (chatMessage.internalConversationId == conversation.databaseId && conversation.databaseUserId == currentUser.id) {
|
if (chatMessage.internalConversationId == conversation.databaseId && conversation.databaseUserId == currentUser.id) {
|
||||||
val sendChatMessageUseCase = SendChatMessageUseCase(networkComponents.getRepository(false, user), apiErrorHandler)
|
val sendChatMessageUseCase = SendChatMessageUseCase(networkComponents.getRepository(false, user), ApiErrorHandler())
|
||||||
sendChatMessageUseCase.invoke(applicationScope, parametersOf(user, conversation.token, chatMessage.message, chatMessage.parentMessage?.jsonMessageId, chatMessage.referenceId), object : UseCaseResponse<Response<ChatOverall>> {
|
sendChatMessageUseCase.invoke(applicationScope, parametersOf(user, conversation.token, chatMessage.message, chatMessage.parentMessage?.jsonMessageId, chatMessage.referenceId), object : UseCaseResponse<Response<ChatOverall>> {
|
||||||
override suspend fun onSuccess(result: Response<ChatOverall>) {
|
override suspend fun onSuccess(result: Response<ChatOverall>) {
|
||||||
messagesOperations.remove(pair.first.internalMessageId!!)
|
messagesOperations.remove(pair.first.internalMessageId!!)
|
||||||
@ -133,7 +133,7 @@ class GlobalService constructor(usersRepository: UsersRepository,
|
|||||||
|
|
||||||
suspend fun exitConversation(conversationToken: String, globalServiceInterface: GlobalServiceInterface) {
|
suspend fun exitConversation(conversationToken: String, globalServiceInterface: GlobalServiceInterface) {
|
||||||
val currentUser = currentUserLiveData.value!!.toUser()
|
val currentUser = currentUserLiveData.value!!.toUser()
|
||||||
val exitConversationUseCase = ExitConversationUseCase(networkComponents.getRepository(true, currentUser), apiErrorHandler)
|
val exitConversationUseCase = ExitConversationUseCase(networkComponents.getRepository(true, currentUser), ApiErrorHandler())
|
||||||
exitConversationUseCase.invoke(applicationScope, parametersOf(currentUser, conversationToken), object: UseCaseResponse<GenericOverall> {
|
exitConversationUseCase.invoke(applicationScope, parametersOf(currentUser, conversationToken), object: UseCaseResponse<GenericOverall> {
|
||||||
override suspend fun onSuccess(result: GenericOverall) {
|
override suspend fun onSuccess(result: GenericOverall) {
|
||||||
globalServiceInterface.leftConversationForUser(currentUser, currentConversation.value, GlobalServiceInterface.OperationStatus.STATUS_OK)
|
globalServiceInterface.leftConversationForUser(currentUser, currentConversation.value, GlobalServiceInterface.OperationStatus.STATUS_OK)
|
||||||
@ -149,7 +149,7 @@ class GlobalService constructor(usersRepository: UsersRepository,
|
|||||||
}
|
}
|
||||||
suspend fun getConversation(conversationToken: String, globalServiceInterface: GlobalServiceInterface) {
|
suspend fun getConversation(conversationToken: String, globalServiceInterface: GlobalServiceInterface) {
|
||||||
val currentUser = currentUserLiveData.value
|
val currentUser = currentUserLiveData.value
|
||||||
val getConversationUseCase = GetConversationUseCase(networkComponents.getRepository(true, currentUser!!.toUser()), apiErrorHandler)
|
val getConversationUseCase = GetConversationUseCase(networkComponents.getRepository(true, currentUser!!.toUser()), ApiErrorHandler())
|
||||||
getConversationUseCase.invoke(applicationScope, parametersOf(
|
getConversationUseCase.invoke(applicationScope, parametersOf(
|
||||||
currentUser,
|
currentUser,
|
||||||
conversationToken
|
conversationToken
|
||||||
@ -174,7 +174,7 @@ class GlobalService constructor(usersRepository: UsersRepository,
|
|||||||
|
|
||||||
suspend fun joinConversation(conversationToken: String, conversationPassword: String?, globalServiceInterface: GlobalServiceInterface) {
|
suspend fun joinConversation(conversationToken: String, conversationPassword: String?, globalServiceInterface: GlobalServiceInterface) {
|
||||||
val currentUser = currentUserLiveData.value
|
val currentUser = currentUserLiveData.value
|
||||||
val joinConversationUseCase = JoinConversationUseCase(networkComponents.getRepository(true, currentUser!!.toUser()), apiErrorHandler)
|
val joinConversationUseCase = JoinConversationUseCase(networkComponents.getRepository(true, currentUser!!.toUser()), ApiErrorHandler())
|
||||||
joinConversationUseCase.invoke(applicationScope, parametersOf(
|
joinConversationUseCase.invoke(applicationScope, parametersOf(
|
||||||
currentUser,
|
currentUser,
|
||||||
conversationToken,
|
conversationToken,
|
||||||
|
@ -56,7 +56,7 @@ class NetworkComponents(
|
|||||||
usersMultipleOperationsRepositoryMap[user.id]
|
usersMultipleOperationsRepositoryMap[user.id]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mappedNextcloudTalkRepository != null) {
|
if (mappedNextcloudTalkRepository != null && user.id != -1L) {
|
||||||
return mappedNextcloudTalkRepository
|
return mappedNextcloudTalkRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ class NetworkComponents(
|
|||||||
usersMultipleOperationOkHttpMap[user.id]
|
usersMultipleOperationOkHttpMap[user.id]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mappedOkHttpClient != null) {
|
if (mappedOkHttpClient != null && user.id != -1L) {
|
||||||
return mappedOkHttpClient
|
return mappedOkHttpClient
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ class NetworkComponents(
|
|||||||
fun getImageLoader(user: User): ImageLoader {
|
fun getImageLoader(user: User): ImageLoader {
|
||||||
var mappedImageLoader = usersImageLoaderMap[user.id]
|
var mappedImageLoader = usersImageLoaderMap[user.id]
|
||||||
|
|
||||||
if (mappedImageLoader == null) {
|
if (mappedImageLoader == null || user.id == -1L) {
|
||||||
mappedImageLoader = ImageLoader(androidApplication) {
|
mappedImageLoader = ImageLoader(androidApplication) {
|
||||||
availableMemoryPercentage(0.5)
|
availableMemoryPercentage(0.5)
|
||||||
bitmapPoolPercentage(0.5)
|
bitmapPoolPercentage(0.5)
|
||||||
|
Loading…
Reference in New Issue
Block a user