mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +01:00
Reformat
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
1a70d28acb
commit
dbf8d406f8
@ -20,7 +20,6 @@
|
||||
|
||||
package com.nextcloud.talk.activities
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
@ -37,7 +36,6 @@ import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.controllers.CallController
|
||||
import com.nextcloud.talk.controllers.CallNotificationController
|
||||
import com.nextcloud.talk.events.ConfigurationChangeEvent
|
||||
import com.nextcloud.talk.newarch.services.CallService
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys
|
||||
|
||||
class MagicCallActivity : BaseActivity() {
|
||||
|
@ -59,6 +59,7 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
|
||||
@BindView(R.id.toolbar)
|
||||
lateinit var toolbar: MaterialToolbar
|
||||
|
||||
@BindView(R.id.controller_container)
|
||||
lateinit var container: ViewGroup
|
||||
|
||||
@ -149,7 +150,7 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
extras.putParcelable(BundleKeys.KEY_USER_ENTITY, it)
|
||||
withContext(Dispatchers.Main) {
|
||||
ConductorRemapping.remapChatController(
|
||||
router!!, it.id!!,
|
||||
router!!, it.id,
|
||||
intent.getStringExtra(BundleKeys.KEY_CONVERSATION_TOKEN)!!, extras, false)
|
||||
}
|
||||
}
|
||||
|
@ -121,8 +121,8 @@ class AdvancedUserItem(
|
||||
|
||||
override fun filter(constraint: String): Boolean {
|
||||
return model.name != null && Pattern.compile(
|
||||
constraint, Pattern.CASE_INSENSITIVE or Pattern.LITERAL
|
||||
)
|
||||
constraint, Pattern.CASE_INSENSITIVE or Pattern.LITERAL
|
||||
)
|
||||
.matcher(model.name!!.trim(' '))
|
||||
.find()
|
||||
}
|
||||
@ -139,18 +139,23 @@ class AdvancedUserItem(
|
||||
@JvmField
|
||||
@BindView(R.id.participantNameTextView)
|
||||
var contactDisplayName: EmojiTextView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.secondary_text)
|
||||
var serverUrl: TextView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.avatar_image)
|
||||
var avatarImageView: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.linear_layout)
|
||||
var linearLayout: LinearLayout? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.more_menu)
|
||||
var moreMenuButton: ImageButton? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.password_protected_image_view)
|
||||
var passwordProtectedImageView: ImageView? = null
|
||||
|
@ -80,9 +80,11 @@ class NotificationSoundItem(
|
||||
@JvmField
|
||||
@BindView(id.notificationNameTextView)
|
||||
var notificationName: TextView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(id.imageView)
|
||||
var imageView: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(id.checkedImageView)
|
||||
var checkedImageView: ImageView? = null
|
||||
|
@ -235,8 +235,8 @@ class UserItem(
|
||||
|
||||
override fun filter(constraint: String): Boolean {
|
||||
return model.displayName != null && (Pattern.compile(
|
||||
constraint, Pattern.CASE_INSENSITIVE or Pattern.LITERAL
|
||||
)
|
||||
constraint, Pattern.CASE_INSENSITIVE or Pattern.LITERAL
|
||||
)
|
||||
.matcher(model.displayName!!.trim(' '))
|
||||
.find() || Pattern.compile(constraint, Pattern.CASE_INSENSITIVE or Pattern.LITERAL)
|
||||
.matcher(model.userId!!.trim(' '))
|
||||
|
@ -49,6 +49,7 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage
|
||||
@JvmField
|
||||
@BindView(R.id.messageText)
|
||||
var messageText: EmojiTextView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.messageTime)
|
||||
var messageTimeView: TextView? = null
|
||||
|
@ -175,10 +175,10 @@ class MagicPreviewMessageViewHolder(itemView: View?) : IncomingImageMessageViewH
|
||||
activeUser: UserNgEntity?
|
||||
) {
|
||||
Single.fromCallable {
|
||||
ReadFilesystemOperation(
|
||||
okHttpClient, activeUser, url, 0
|
||||
)
|
||||
}
|
||||
ReadFilesystemOperation(
|
||||
okHttpClient, activeUser, url, 0
|
||||
)
|
||||
}
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(object : SingleObserver<ReadFilesystemOperation?> {
|
||||
override fun onSubscribe(d: Disposable) {}
|
||||
|
@ -53,7 +53,6 @@ import com.nextcloud.talk.newarch.features.contactsflow.di.module.ContactsFlowMo
|
||||
import com.nextcloud.talk.newarch.features.conversationslist.di.module.ConversationsListModule
|
||||
import com.nextcloud.talk.newarch.local.dao.UsersDao
|
||||
import com.nextcloud.talk.newarch.local.models.User
|
||||
import com.nextcloud.talk.newarch.local.models.UserNgEntity
|
||||
import com.nextcloud.talk.newarch.local.models.other.UserStatus.*
|
||||
import com.nextcloud.talk.newarch.local.models.toUserEntity
|
||||
import com.nextcloud.talk.newarch.services.shortcuts.ShortcutService
|
||||
@ -147,9 +146,9 @@ class NextcloudTalkApplication : Application(), LifecycleObserver, Configuration
|
||||
val accountRemovalWork = OneTimeWorkRequest.Builder(AccountRemovalWorker::class.java)
|
||||
.build()
|
||||
val periodicCapabilitiesUpdateWork = PeriodicWorkRequest.Builder(
|
||||
CapabilitiesWorker::class.java,
|
||||
12, TimeUnit.HOURS
|
||||
)
|
||||
CapabilitiesWorker::class.java,
|
||||
12, TimeUnit.HOURS
|
||||
)
|
||||
.build()
|
||||
val signalingSettingsWork = OneTimeWorkRequest.Builder(SignalingSettingsWorker::class.java)
|
||||
.build()
|
||||
@ -197,7 +196,7 @@ class NextcloudTalkApplication : Application(), LifecycleObserver, Configuration
|
||||
var newUser: User
|
||||
val newUsers = mutableListOf<User>()
|
||||
for (user in users) {
|
||||
newUser = User(userId = user.userId, username = user.username, baseUrl = user.baseUrl, token = user.token, displayName = user.displayName)
|
||||
newUser = User(userId = user.userId, username = user.username, baseUrl = user.baseUrl, token = user.token, displayName = user.displayName)
|
||||
try {
|
||||
newUser.pushConfiguration =
|
||||
LoganSquare.parse(user.pushConfigurationState, PushConfiguration::class.java)
|
||||
@ -233,7 +232,7 @@ class NextcloudTalkApplication : Application(), LifecycleObserver, Configuration
|
||||
val userEntities = newUsers.map {
|
||||
it.toUserEntity()
|
||||
}
|
||||
|
||||
|
||||
usersDao.saveUsers(*userEntities.toTypedArray())
|
||||
dataStore.delete()
|
||||
appPreferences.migrationToRoomFinished = true
|
||||
|
@ -153,18 +153,23 @@ class BrowserFileItem(
|
||||
@JvmField
|
||||
@BindView(R.id.file_icon)
|
||||
var fileIconImageView: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.fileModifiedTextView)
|
||||
var fileModifiedTextView: TextView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.filenameTextView)
|
||||
var filenameTextView: TextView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.selectFileCheckbox)
|
||||
var selectFileCheckbox: CheckBox? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.fileEncryptedImageView)
|
||||
var fileEncryptedImageView: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.fileFavoriteImageView)
|
||||
var fileFavoriteImageView: ImageView? = null
|
||||
|
@ -55,15 +55,19 @@ import java.util.*
|
||||
|
||||
class BrowserController(args: Bundle) : BaseController(), ListingInterface, FlexibleAdapter.OnItemClickListener, SelectionInterface {
|
||||
private val selectedPaths: MutableSet<String>
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.recyclerView)
|
||||
internal var recyclerView: RecyclerView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.fast_scroller)
|
||||
internal var fastScroller: FastScroller? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.action_back)
|
||||
internal var backMenuItem: BottomNavigationItemView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.action_refresh)
|
||||
internal var actionRefreshMenuItem: BottomNavigationItemView? = null
|
||||
@ -126,7 +130,7 @@ class BrowserController(args: Bundle) : BaseController(), ListingInterface, Flex
|
||||
iterator.remove()
|
||||
if (paths.size == 10 || !iterator.hasNext()) {
|
||||
data = Data.Builder()
|
||||
.putLong(BundleKeys.KEY_INTERNAL_USER_ID, activeUser.id!!)
|
||||
.putLong(BundleKeys.KEY_INTERNAL_USER_ID, activeUser.id)
|
||||
.putString(BundleKeys.KEY_CONVERSATION_TOKEN, roomToken)
|
||||
.putStringArray(BundleKeys.KEY_FILE_PATHS, paths.toTypedArray())
|
||||
.build()
|
||||
|
@ -96,12 +96,15 @@ class CallController(args: Bundle) : BaseController() {
|
||||
@JvmField
|
||||
@BindView(R.id.callControlEnableSpeaker)
|
||||
var callControlEnableSpeaker: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.pip_video_view)
|
||||
var pipVideoView: SurfaceViewRenderer? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.relative_layout)
|
||||
var relativeLayout: RelativeLayout? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.remote_renderers_layout)
|
||||
var remoteRenderersLayout: LinearLayout? = null
|
||||
@ -109,15 +112,19 @@ class CallController(args: Bundle) : BaseController() {
|
||||
@JvmField
|
||||
@BindView(R.id.callControlsRelativeLayout)
|
||||
var callControls: RelativeLayout? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.call_control_microphone)
|
||||
var microphoneControlButton: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.call_control_camera)
|
||||
var cameraControlButton: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.call_control_switch_camera)
|
||||
var cameraSwitchButton: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.connectingTextView)
|
||||
var connectingTextView: TextView? = null
|
||||
@ -1028,11 +1035,11 @@ class CallController(args: Bundle) : BaseController() {
|
||||
|
||||
private fun joinRoomAndCall() {
|
||||
ncApi.joinRoom(
|
||||
credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(
|
||||
baseUrl,
|
||||
roomToken
|
||||
), conversationPassword
|
||||
)
|
||||
credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(
|
||||
baseUrl,
|
||||
roomToken
|
||||
), conversationPassword
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.retry(3)
|
||||
@ -1067,9 +1074,9 @@ class CallController(args: Bundle) : BaseController() {
|
||||
|
||||
private fun performCall() {
|
||||
ncApi.joinCall(
|
||||
credentials,
|
||||
ApiUtils.getUrlForCall(baseUrl, roomToken)
|
||||
)
|
||||
credentials,
|
||||
ApiUtils.getUrlForCall(baseUrl, roomToken)
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.retry(3)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -1129,9 +1136,9 @@ class CallController(args: Bundle) : BaseController() {
|
||||
|
||||
if (!hasExternalSignalingServer) {
|
||||
ncApi.pullSignalingMessages(
|
||||
credentials,
|
||||
ApiUtils.getUrlForSignaling(baseUrl, urlToken)
|
||||
)
|
||||
credentials,
|
||||
ApiUtils.getUrlForSignaling(baseUrl, urlToken)
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.repeatWhen { observable -> observable }
|
||||
@ -1445,9 +1452,9 @@ class CallController(args: Bundle) : BaseController() {
|
||||
|
||||
private fun leaveRoom(shutDownView: Boolean) {
|
||||
ncApi.leaveRoom(
|
||||
credentials,
|
||||
ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, roomToken)
|
||||
)
|
||||
credentials,
|
||||
ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, roomToken)
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Observer<GenericOverall> {
|
||||
@ -1879,9 +1886,9 @@ class CallController(args: Bundle) : BaseController() {
|
||||
}
|
||||
|
||||
ncApi.sendSignalingMessages(
|
||||
credentials, ApiUtils.getUrlForSignaling(baseUrl, urlToken),
|
||||
strings.toString()
|
||||
)
|
||||
credentials, ApiUtils.getUrlForSignaling(baseUrl, urlToken),
|
||||
strings.toString()
|
||||
)
|
||||
.retry(3)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(object : Observer<SignalingOverall> {
|
||||
|
@ -26,10 +26,7 @@ import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.media.MediaPlayer
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Vibrator
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -53,19 +50,12 @@ import com.nextcloud.talk.controllers.base.BaseController
|
||||
import com.nextcloud.talk.events.CallEvent
|
||||
import com.nextcloud.talk.events.ConfigurationChangeEvent
|
||||
import com.nextcloud.talk.models.json.conversations.Conversation
|
||||
import com.nextcloud.talk.models.json.participants.Participant
|
||||
import com.nextcloud.talk.models.json.participants.ParticipantsOverall
|
||||
import com.nextcloud.talk.newarch.local.models.UserNgEntity
|
||||
import com.nextcloud.talk.newarch.local.models.getCredentials
|
||||
import com.nextcloud.talk.newarch.services.CallService
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys
|
||||
import com.nextcloud.talk.utils.database.arbitrarystorage.ArbitraryStorageUtils
|
||||
import com.nextcloud.talk.utils.singletons.AvatarStatusCodeHolder
|
||||
import com.uber.autodispose.AutoDispose
|
||||
import io.reactivex.Observer
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
@ -130,6 +120,7 @@ class CallNotificationController(private val originalBundle: Bundle) : BaseContr
|
||||
hideIncomingCallNotificationIntent.putExtra(BundleKeys.KEY_ACTIVE_NOTIFICATION, activeNotification)
|
||||
applicationContext?.startService(hideIncomingCallNotificationIntent)
|
||||
}
|
||||
|
||||
@OnClick(R.id.callControlHangupView)
|
||||
internal fun hangup() {
|
||||
dismissIncomingCallNotification()
|
||||
|
@ -113,27 +113,35 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
|
||||
@BindView(R.id.messagesListView)
|
||||
@JvmField
|
||||
var messagesListView: MessagesList? = null
|
||||
|
||||
@BindView(R.id.messageInputView)
|
||||
@JvmField
|
||||
var messageInputView: MessageInput? = null
|
||||
|
||||
@BindView(R.id.messageInput)
|
||||
@JvmField
|
||||
var messageInput: EmojiEditText? = null
|
||||
|
||||
@BindView(R.id.popupBubbleView)
|
||||
@JvmField
|
||||
var popupBubble: PopupBubble? = null
|
||||
|
||||
@BindView(R.id.progressBar)
|
||||
@JvmField
|
||||
var loadingProgressBar: ProgressBar? = null
|
||||
|
||||
@BindView(R.id.smileyButton)
|
||||
@JvmField
|
||||
var smileyButton: ImageButton? = null
|
||||
|
||||
@BindView(R.id.lobbyView)
|
||||
@JvmField
|
||||
var lobbyView: RelativeLayout? = null
|
||||
|
||||
@BindView(R.id.lobbyTextView)
|
||||
@JvmField
|
||||
var conversationLobbyText: TextView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.quotedChatMessageView)
|
||||
var quotedChatMessageView: RelativeLayout? = null
|
||||
@ -294,9 +302,9 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
|
||||
.ONE_TO_ONE_CONVERSATION && activity != null && conversationVoiceCallMenuItem != null
|
||||
) {
|
||||
val avatarSize = DisplayUtils.convertDpToPixel(
|
||||
conversationVoiceCallMenuItem?.icon!!
|
||||
.intrinsicWidth.toFloat(), activity!!
|
||||
)
|
||||
conversationVoiceCallMenuItem?.icon!!
|
||||
.intrinsicWidth.toFloat(), activity!!
|
||||
)
|
||||
.toInt()
|
||||
|
||||
avatarSize.let {
|
||||
@ -755,11 +763,11 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
|
||||
private fun startPing() {
|
||||
if (conversationUser != null && !conversationUser.hasSpreedFeatureCapability("no-ping")) {
|
||||
ncApi.pingCall(
|
||||
credentials, ApiUtils.getUrlForCallPing(
|
||||
conversationUser.baseUrl,
|
||||
roomToken
|
||||
)
|
||||
)
|
||||
credentials, ApiUtils.getUrlForCallPing(
|
||||
conversationUser.baseUrl,
|
||||
roomToken
|
||||
)
|
||||
)
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.repeatWhen { observable -> observable.delay(5000, TimeUnit.MILLISECONDS) }
|
||||
@ -792,10 +800,10 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
|
||||
currentConversation?.sessionId == "0"
|
||||
) {
|
||||
ncApi.joinRoom(
|
||||
credentials,
|
||||
ApiUtils.getUrlForSettingMyselfAsActiveParticipant(conversationUser?.baseUrl, roomToken),
|
||||
roomPassword
|
||||
)
|
||||
credentials,
|
||||
ApiUtils.getUrlForSettingMyselfAsActiveParticipant(conversationUser?.baseUrl, roomToken),
|
||||
roomPassword
|
||||
)
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.retry(3)
|
||||
@ -856,12 +864,12 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
|
||||
|
||||
private fun leaveRoom() {
|
||||
ncApi.leaveRoom(
|
||||
credentials,
|
||||
ApiUtils.getUrlForSettingMyselfAsActiveParticipant(
|
||||
conversationUser?.baseUrl,
|
||||
roomToken
|
||||
credentials,
|
||||
ApiUtils.getUrlForSettingMyselfAsActiveParticipant(
|
||||
conversationUser?.baseUrl,
|
||||
roomToken
|
||||
)
|
||||
)
|
||||
)
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<GenericOverall> {
|
||||
@ -937,12 +945,12 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
|
||||
|
||||
if (conversationUser != null) {
|
||||
ncApi.sendChatMessage(
|
||||
credentials, ApiUtils.getUrlForChat(
|
||||
conversationUser.baseUrl,
|
||||
roomToken
|
||||
),
|
||||
message, conversationUser.displayName, replyTo
|
||||
)
|
||||
credentials, ApiUtils.getUrlForChat(
|
||||
conversationUser.baseUrl,
|
||||
roomToken
|
||||
),
|
||||
message, conversationUser.displayName, replyTo
|
||||
)
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.`as`(AutoDispose.autoDisposable(scopeProvider))
|
||||
@ -986,11 +994,11 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
|
||||
private fun setupWebsocket() {
|
||||
if (conversationUser != null) {
|
||||
if (WebSocketConnectionHelper.getMagicWebSocketInstanceForUserId(
|
||||
conversationUser.id!!
|
||||
conversationUser.id
|
||||
) != null
|
||||
) {
|
||||
magicWebSocketInstance =
|
||||
WebSocketConnectionHelper.getMagicWebSocketInstanceForUserId(conversationUser.id!!)
|
||||
WebSocketConnectionHelper.getMagicWebSocketInstanceForUserId(conversationUser.id)
|
||||
} else {
|
||||
magicWebSocketInstance = null
|
||||
}
|
||||
@ -1045,8 +1053,8 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
|
||||
if (lookIntoFuture > 0) {
|
||||
val finalTimeout = timeout
|
||||
ncApi.pullChatMessages(
|
||||
credentials, ApiUtils.getUrlForChat(conversationUser?.baseUrl, roomToken), fieldMap
|
||||
)
|
||||
credentials, ApiUtils.getUrlForChat(conversationUser?.baseUrl, roomToken), fieldMap
|
||||
)
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.takeWhile { observable -> inConversation && !wasDetached }
|
||||
@ -1074,9 +1082,9 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
|
||||
|
||||
} else {
|
||||
ncApi.pullChatMessages(
|
||||
credentials,
|
||||
ApiUtils.getUrlForChat(conversationUser?.baseUrl, roomToken), fieldMap
|
||||
)
|
||||
credentials,
|
||||
ApiUtils.getUrlForChat(conversationUser?.baseUrl, roomToken), fieldMap
|
||||
)
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.retry(3) { observable -> inConversation && !wasDetached }
|
||||
@ -1482,9 +1490,9 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
|
||||
)
|
||||
|
||||
ncApi.createRoom(
|
||||
credentials,
|
||||
retrofitBucket.url, retrofitBucket.queryMap
|
||||
)
|
||||
credentials,
|
||||
retrofitBucket.url, retrofitBucket.queryMap
|
||||
)
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.`as`(AutoDispose.autoDisposable(scopeProvider))
|
||||
@ -1512,7 +1520,7 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
|
||||
null && conversationOverall.ocs.data.token != null
|
||||
) {
|
||||
ConductorRemapping.remapChatController(
|
||||
router, conversationUser.id!!,
|
||||
router, conversationUser.id,
|
||||
conversationOverall.ocs.data.token!!, bundle, false
|
||||
)
|
||||
}
|
||||
|
@ -117,46 +117,67 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
|
||||
@BindView(R.id.notification_settings)
|
||||
lateinit var notificationsPreferenceScreen: MaterialPreferenceScreen
|
||||
|
||||
@BindView(R.id.progressBar)
|
||||
lateinit var progressBar: ProgressBar
|
||||
|
||||
@BindView(R.id.conversation_info_message_notifications)
|
||||
lateinit var messageNotificationLevel: MaterialChoicePreference
|
||||
|
||||
@BindView(R.id.webinar_settings)
|
||||
lateinit var conversationInfoWebinar: MaterialPreferenceScreen
|
||||
|
||||
@BindView(R.id.conversation_info_lobby)
|
||||
lateinit var conversationInfoLobby: MaterialSwitchPreference
|
||||
|
||||
@BindView(R.id.conversation_info_name)
|
||||
lateinit var nameCategoryView: MaterialPreferenceCategory
|
||||
|
||||
@BindView(R.id.start_time_preferences)
|
||||
lateinit var startTimeView: MaterialStandardPreference
|
||||
|
||||
@BindView(R.id.avatar_image)
|
||||
lateinit var conversationAvatarImageView: ImageView
|
||||
|
||||
@BindView(R.id.display_name_text)
|
||||
lateinit var conversationDisplayName: EmojiTextView
|
||||
|
||||
@BindView(R.id.participants_list_category)
|
||||
lateinit var participantsListCategory: MaterialPreferenceCategoryWithRightLink
|
||||
|
||||
@BindView(R.id.recyclerView)
|
||||
lateinit var recyclerView: RecyclerView
|
||||
|
||||
@BindView(R.id.deleteConversationAction)
|
||||
lateinit var deleteConversationAction: MaterialStandardPreference
|
||||
|
||||
@BindView(R.id.leaveConversationAction)
|
||||
lateinit var leaveConversationAction: MaterialStandardPreference
|
||||
|
||||
@BindView(R.id.ownOptions)
|
||||
lateinit var ownOptionsCategory: MaterialPreferenceCategory
|
||||
|
||||
@BindView(R.id.muteCalls)
|
||||
lateinit var muteCalls: MaterialSwitchPreference
|
||||
|
||||
@BindView(R.id.mpc_action)
|
||||
lateinit var actionTextView: TextView
|
||||
|
||||
@BindView(R.id.generalConversationOptions)
|
||||
lateinit var generalConversationOptions: MaterialPreferenceScreen
|
||||
|
||||
@BindView(R.id.changeConversationName)
|
||||
lateinit var changeConversationName: MaterialEditTextPreference
|
||||
|
||||
@BindView(R.id.favoriteConversationAction)
|
||||
lateinit var favoriteConversationAction: MaterialSwitchPreference
|
||||
|
||||
@BindView(R.id.allowGuestsAction)
|
||||
lateinit var allowGuestsAction: MaterialSwitchPreference
|
||||
|
||||
@BindView(R.id.passwordAction)
|
||||
lateinit var passwordAction: MaterialEditTextPreference
|
||||
|
||||
@BindView(R.id.shareAction)
|
||||
lateinit var shareAction: MaterialStandardPreference
|
||||
|
||||
@ -181,7 +202,7 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
if (!TextUtils.isEmpty(conversationToken) && conversationUser != null) {
|
||||
val data = Data.Builder()
|
||||
data.putString(BundleKeys.KEY_CONVERSATION_TOKEN, conversationToken)
|
||||
data.putLong(BundleKeys.KEY_INTERNAL_USER_ID, conversationUser.id!!)
|
||||
data.putLong(BundleKeys.KEY_INTERNAL_USER_ID, conversationUser.id)
|
||||
return data.build()
|
||||
}
|
||||
|
||||
@ -318,7 +339,7 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
if (databaseStorageModule != null && conversationUser != null && conversation != null) {
|
||||
if ((allowGuestsAction.findViewById<View>(R.id.mp_checkable) as SwitchCompat).isChecked) {
|
||||
ncApi.makeRoomPublic(conversationUser.getCredentials(), ApiUtils.getUrlForRoomVisibility
|
||||
(conversationUser.baseUrl, conversation!!.token))
|
||||
(conversationUser.baseUrl, conversation!!.token))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Observer<GenericOverall> {
|
||||
@ -336,7 +357,7 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
})
|
||||
} else {
|
||||
ncApi.makeRoomPrivate(conversationUser.getCredentials(), ApiUtils.getUrlForRoomVisibility
|
||||
(conversationUser.baseUrl, conversation!!.token))
|
||||
(conversationUser.baseUrl, conversation!!.token))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Observer<GenericOverall> {
|
||||
@ -360,7 +381,7 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
if (databaseStorageModule != null && conversationUser != null && conversation != null) {
|
||||
if ((favoriteConversationAction.findViewById<View>(R.id.mp_checkable) as SwitchCompat).isChecked) {
|
||||
ncApi.addConversationToFavorites(conversationUser.getCredentials(), ApiUtils
|
||||
.getUrlForConversationFavorites(conversationUser.baseUrl, conversation!!.token))
|
||||
.getUrlForConversationFavorites(conversationUser.baseUrl, conversation!!.token))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Observer<GenericOverall> {
|
||||
@ -379,7 +400,7 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
})
|
||||
} else {
|
||||
ncApi.removeConversationFromFavorites(conversationUser.getCredentials(), ApiUtils
|
||||
.getUrlForConversationFavorites(conversationUser.baseUrl, conversation!!.token))
|
||||
.getUrlForConversationFavorites(conversationUser.baseUrl, conversation!!.token))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Observer<GenericOverall> {
|
||||
@ -407,12 +428,12 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
) as SwitchCompat).isChecked
|
||||
) 1 else 0
|
||||
ncApi.setLobbyForConversation(
|
||||
ApiUtils.getCredentials(
|
||||
conversationUser!!.username,
|
||||
conversationUser.token
|
||||
), ApiUtils.getUrlForLobbyForConversation
|
||||
(conversationUser.baseUrl, conversation!!.token), state, conversation!!.lobbyTimer
|
||||
)
|
||||
ApiUtils.getCredentials(
|
||||
conversationUser!!.username,
|
||||
conversationUser.token
|
||||
), ApiUtils.getUrlForLobbyForConversation
|
||||
(conversationUser.baseUrl, conversation!!.token), state, conversation!!.lobbyTimer
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Observer<GenericOverall> {
|
||||
@ -554,8 +575,8 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
|
||||
private fun getListOfParticipants() {
|
||||
ncApi.getPeersForCall(
|
||||
credentials, ApiUtils.getUrlForParticipants(conversationUser!!.baseUrl, conversationToken)
|
||||
)
|
||||
credentials, ApiUtils.getUrlForParticipants(conversationUser!!.baseUrl, conversationToken)
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Observer<ParticipantsOverall> {
|
||||
@ -873,10 +894,10 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
if (index == 0) {
|
||||
if (participant.type == Participant.ParticipantType.MODERATOR) {
|
||||
ncApi.demoteModeratorToUser(
|
||||
credentials,
|
||||
ApiUtils.getUrlForModerators(conversationUser.baseUrl, conversation!!.token),
|
||||
participant.userId
|
||||
)
|
||||
credentials,
|
||||
ApiUtils.getUrlForModerators(conversationUser.baseUrl, conversation!!.token),
|
||||
participant.userId
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
@ -884,10 +905,10 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
}
|
||||
} else if (participant.type == Participant.ParticipantType.USER) {
|
||||
ncApi.promoteUserToModerator(
|
||||
credentials,
|
||||
ApiUtils.getUrlForModerators(conversationUser.baseUrl, conversation!!.token),
|
||||
participant.userId
|
||||
)
|
||||
credentials,
|
||||
ApiUtils.getUrlForModerators(conversationUser.baseUrl, conversation!!.token),
|
||||
participant.userId
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
@ -899,10 +920,10 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
participant.type == Participant.ParticipantType.USER_FOLLOWING_LINK
|
||||
) {
|
||||
ncApi.removeParticipantFromConversation(
|
||||
credentials, ApiUtils.getUrlForRemovingParticipantFromConversation(
|
||||
conversationUser.baseUrl, conversation!!.token, true
|
||||
), participant.sessionId
|
||||
)
|
||||
credentials, ApiUtils.getUrlForRemovingParticipantFromConversation(
|
||||
conversationUser.baseUrl, conversation!!.token, true
|
||||
), participant.sessionId
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
@ -911,10 +932,10 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
|
||||
} else {
|
||||
ncApi.removeParticipantFromConversation(
|
||||
credentials, ApiUtils.getUrlForRemovingParticipantFromConversation(
|
||||
conversationUser.baseUrl, conversation!!.token, false
|
||||
), participant.userId
|
||||
)
|
||||
credentials, ApiUtils.getUrlForRemovingParticipantFromConversation(
|
||||
conversationUser.baseUrl, conversation!!.token, false
|
||||
), participant.userId
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
|
@ -87,72 +87,95 @@ class SettingsController : BaseController() {
|
||||
@JvmField
|
||||
@BindView(R.id.settings_screen)
|
||||
var settingsScreen: MaterialPreferenceScreen? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_proxy_choice)
|
||||
var proxyChoice: MaterialChoicePreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_proxy_port_edit)
|
||||
var proxyPortEditText: MaterialEditTextPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_licence)
|
||||
var licenceButton: MaterialStandardPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_privacy)
|
||||
var privacyButton: MaterialStandardPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_source_code)
|
||||
var sourceCodeButton: MaterialStandardPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_version)
|
||||
var versionInfo: MaterialStandardPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.avatar_image)
|
||||
var avatarImageView: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.display_name_text)
|
||||
var displayNameTextView: EmojiTextView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.base_url_text)
|
||||
var baseUrlTextView: TextView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_call_sound)
|
||||
var settingsCallSound: MaterialStandardPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_message_sound)
|
||||
var settingsMessageSound: MaterialStandardPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_remove_account)
|
||||
var removeAccountButton: MaterialStandardPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_switch)
|
||||
var switchAccountButton: MaterialStandardPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_reauthorize)
|
||||
var reauthorizeButton: MaterialStandardPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_add_account)
|
||||
var addAccountButton: MaterialStandardPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.message_view)
|
||||
var messageView: MaterialPreferenceCategory? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_client_cert)
|
||||
var certificateSetup: MaterialStandardPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_always_vibrate)
|
||||
var shouldVibrateSwitchPreference: MaterialSwitchPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_incognito_keyboard)
|
||||
var incognitoKeyboardSwitchPreference: MaterialSwitchPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_screen_security)
|
||||
var screenSecuritySwitchPreference: MaterialSwitchPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_link_previews)
|
||||
var linkPreviewsSwitchPreference: MaterialSwitchPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_screen_lock)
|
||||
var screenLockSwitchPreference: MaterialSwitchPreference? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.settings_screen_lock_timeout)
|
||||
var screenLockTimeoutChoicePreference: MaterialChoicePreference? = null
|
||||
@ -277,8 +300,8 @@ class SettingsController : BaseController() {
|
||||
} else {
|
||||
withContext(Dispatchers.Main) {
|
||||
router.setRoot(RouterTransaction.with(
|
||||
ServerEntryView()
|
||||
)
|
||||
ServerEntryView()
|
||||
)
|
||||
.pushChangeHandler(VerticalChangeHandler())
|
||||
.popChangeHandler(VerticalChangeHandler())
|
||||
)
|
||||
@ -397,8 +420,8 @@ class SettingsController : BaseController() {
|
||||
addAccountButton!!.addPreferenceClickListener { view15 ->
|
||||
router.pushController(
|
||||
RouterTransaction.with(ServerEntryView()).pushChangeHandler(
|
||||
VerticalChangeHandler()
|
||||
)
|
||||
VerticalChangeHandler()
|
||||
)
|
||||
.popChangeHandler(VerticalChangeHandler())
|
||||
)
|
||||
}
|
||||
@ -406,8 +429,8 @@ class SettingsController : BaseController() {
|
||||
switchAccountButton!!.addPreferenceClickListener { view16 ->
|
||||
router.pushController(
|
||||
RouterTransaction.with(SwitchAccountController()).pushChangeHandler(
|
||||
VerticalChangeHandler()
|
||||
)
|
||||
VerticalChangeHandler()
|
||||
)
|
||||
.popChangeHandler(VerticalChangeHandler())
|
||||
)
|
||||
}
|
||||
@ -442,7 +465,7 @@ class SettingsController : BaseController() {
|
||||
realAlias = ""
|
||||
}
|
||||
|
||||
currentUser = usersRepository.getUserWithId(currentUser!!.id!!)
|
||||
currentUser = usersRepository.getUserWithId(currentUser!!.id)
|
||||
currentUser!!.clientCertificate = realAlias
|
||||
GlobalScope.launch {
|
||||
usersRepository.updateUser(currentUser!!)
|
||||
@ -577,9 +600,9 @@ class SettingsController : BaseController() {
|
||||
loadAvatarImage()
|
||||
|
||||
ncApi.getUserProfile(
|
||||
credentials,
|
||||
ApiUtils.getUrlForUserProfile(currentUser!!.baseUrl)
|
||||
)
|
||||
credentials,
|
||||
ApiUtils.getUrlForUserProfile(currentUser!!.baseUrl)
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.`as`<ObservableSubscribeProxy<UserProfileOverall>>(
|
||||
@ -590,7 +613,7 @@ class SettingsController : BaseController() {
|
||||
var displayName: String? = userProfileOverall.ocs.data.displayName
|
||||
|
||||
if (!TextUtils.isEmpty(displayName) && displayName != currentUser!!.displayName) {
|
||||
val user = usersRepository.getUserWithId(currentUser!!.id!!)
|
||||
val user = usersRepository.getUserWithId(currentUser!!.id)
|
||||
user.displayName = displayName
|
||||
GlobalScope.launch {
|
||||
usersRepository.updateUser(user)
|
||||
|
@ -82,7 +82,7 @@ class SwitchAccountController : BaseController {
|
||||
if (userItems.size > position) {
|
||||
val userEntity = (userItems[position] as AdvancedUserItem).entity
|
||||
GlobalScope.launch {
|
||||
usersRepository.setUserAsActiveWithId(userEntity!!.id!!)
|
||||
usersRepository.setUserAsActiveWithId(userEntity!!.id)
|
||||
cookieManager.cookieStore.removeAll()
|
||||
withContext(Dispatchers.Main) {
|
||||
router.popCurrentController()
|
||||
|
@ -45,7 +45,6 @@ import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.activities.MainActivity
|
||||
import com.nextcloud.talk.controllers.SwitchAccountController
|
||||
import com.nextcloud.talk.controllers.base.providers.ActionBarProvider
|
||||
import com.nextcloud.talk.newarch.utils.dp
|
||||
import com.nextcloud.talk.newarch.utils.px
|
||||
import com.nextcloud.talk.utils.preferences.AppPreferences
|
||||
import com.uber.autodispose.lifecycle.LifecycleScopeProvider
|
||||
|
@ -57,7 +57,7 @@ class AccountRemovalWorker(context: Context, workerParams: WorkerParameters) : C
|
||||
userEntity.pushConfiguration?.let {
|
||||
ncApi = retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(JavaNetCookieJar(CookieManager())).build()).build().create(NcApi::class.java)
|
||||
ncApi!!.unregisterDeviceForNotificationsWithNextcloud(credentials,
|
||||
ApiUtils.getUrlNextcloudPush(userEntity.baseUrl))
|
||||
ApiUtils.getUrlNextcloudPush(userEntity.baseUrl))
|
||||
.blockingSubscribe(object : Observer<GenericOverall> {
|
||||
override fun onSubscribe(d: Disposable) {}
|
||||
override fun onNext(genericOverall: GenericOverall) {
|
||||
@ -77,7 +77,7 @@ class AccountRemovalWorker(context: Context, workerParams: WorkerParameters) : C
|
||||
})
|
||||
} ?: run {
|
||||
runBlocking {
|
||||
usersRepository.deleteUserWithId(userEntity.id!!)
|
||||
usersRepository.deleteUserWithId(userEntity.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -100,7 +100,7 @@ class AccountRemovalWorker(context: Context, workerParams: WorkerParameters) : C
|
||||
//deleteExternalSignalingInstanceForUserEntity(
|
||||
// userEntity.id!!)
|
||||
runBlocking {
|
||||
usersRepository.deleteUserWithId(userEntity.id!!)
|
||||
usersRepository.deleteUserWithId(userEntity.id)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class CapabilitiesWorker(context: Context, workerParams: WorkerParameters) : Cor
|
||||
internalUserEntity.capabilities = capabilitiesOverall.ocs.data.capabilities
|
||||
runBlocking {
|
||||
val result = usersRepository.updateUser(internalUserEntity)
|
||||
eventBus.post(EventStatus(internalUserEntity.id!!,
|
||||
eventBus.post(EventStatus(internalUserEntity.id,
|
||||
EventStatus.EventType.CAPABILITIES_FETCH, result > 0))
|
||||
}
|
||||
|
||||
@ -73,8 +73,8 @@ class CapabilitiesWorker(context: Context, workerParams: WorkerParameters) : Cor
|
||||
for (userEntityObject in userEntityObjectList) {
|
||||
ncApi = retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(JavaNetCookieJar(CookieManager())).build()).build().create(NcApi::class.java)
|
||||
ncApi!!.getCapabilities(ApiUtils.getCredentials(userEntityObject.username,
|
||||
userEntityObject.token),
|
||||
ApiUtils.getUrlForCapabilities(userEntityObject.baseUrl))
|
||||
userEntityObject.token),
|
||||
ApiUtils.getUrlForCapabilities(userEntityObject.baseUrl))
|
||||
.retry(3)
|
||||
.blockingSubscribe(object : Observer<CapabilitiesOverall> {
|
||||
override fun onSubscribe(d: Disposable) {}
|
||||
@ -83,7 +83,7 @@ class CapabilitiesWorker(context: Context, workerParams: WorkerParameters) : Cor
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
eventBus.post(EventStatus(userEntityObject.id!!,
|
||||
eventBus.post(EventStatus(userEntityObject.id,
|
||||
EventStatus.EventType.CAPABILITIES_FETCH, false))
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ class DeleteConversationWorker(context: Context,
|
||||
operationUser?.let {
|
||||
val credentials = it.getCredentials()
|
||||
ncApi = retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(JavaNetCookieJar(CookieManager())).build()).build().create(NcApi::class.java)
|
||||
val eventStatus = EventStatus(it.id!!,
|
||||
val eventStatus = EventStatus(it.id,
|
||||
EventStatus.EventType.CONVERSATION_UPDATE, true)
|
||||
ncApi!!.deleteRoom(credentials, ApiUtils.getRoom(it.baseUrl, conversationToken))
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
@ -56,10 +56,10 @@ class LeaveConversationWorker(context: Context, workerParams: WorkerParameters)
|
||||
if (operationUser != null) {
|
||||
val credentials = operationUser.getCredentials()
|
||||
ncApi = retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(JavaNetCookieJar(CookieManager())).build()).build().create(NcApi::class.java)
|
||||
val eventStatus = EventStatus(operationUser.id!!,
|
||||
val eventStatus = EventStatus(operationUser.id,
|
||||
EventStatus.EventType.CONVERSATION_UPDATE, true)
|
||||
ncApi!!.removeSelfFromRoom(credentials,
|
||||
ApiUtils.getUrlForRemoveSelfFromRoom(operationUser.baseUrl, conversationToken))
|
||||
ApiUtils.getUrlForRemoveSelfFromRoom(operationUser.baseUrl, conversationToken))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.blockingSubscribe(object : Observer<GenericOverall?> {
|
||||
var disposable: Disposable? = null
|
||||
|
@ -115,7 +115,7 @@ class MessageNotificationWorker(
|
||||
var conversationTypeString = "one2one"
|
||||
val notification = result.ocs.notification
|
||||
|
||||
notification.messageRichParameters?.let { messageRichParameters ->
|
||||
notification.messageRichParameters?.let { messageRichParameters ->
|
||||
if (messageRichParameters.size > 0) {
|
||||
decryptedPushMessage.text = ChatUtils.getParsedMessage(notification.messageRich, messageRichParameters)
|
||||
} else {
|
||||
@ -249,7 +249,7 @@ class MessageNotificationWorker(
|
||||
var notificationId = decryptedPushMessage.timestamp.toInt()
|
||||
|
||||
val notificationInfoBundle = Bundle()
|
||||
notificationInfoBundle.putLong(BundleKeys.KEY_INTERNAL_USER_ID, signatureVerification.userEntity!!.id!!)
|
||||
notificationInfoBundle.putLong(BundleKeys.KEY_INTERNAL_USER_ID, signatureVerification.userEntity!!.id)
|
||||
notificationInfoBundle.putString(BundleKeys.KEY_CONVERSATION_TOKEN, decryptedPushMessage.id)
|
||||
notificationInfoBundle.putLong(BundleKeys.KEY_NOTIFICATION_ID, decryptedPushMessage.notificationId!!)
|
||||
notificationBuilder.extras = notificationInfoBundle
|
||||
|
@ -53,12 +53,12 @@ class ShareOperationWorker(
|
||||
override fun doWork(): Result {
|
||||
for (i in filesArray.indices) {
|
||||
ncApi.createRemoteShare(
|
||||
credentials,
|
||||
ApiUtils.getSharingUrl(baseUrl),
|
||||
filesArray[i],
|
||||
roomToken,
|
||||
"10"
|
||||
)
|
||||
credentials,
|
||||
ApiUtils.getSharingUrl(baseUrl),
|
||||
filesArray[i],
|
||||
roomToken,
|
||||
"10"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.blockingSubscribe(object : Observer<Void?> {
|
||||
override fun onSubscribe(d: Disposable) {}
|
||||
|
@ -61,8 +61,8 @@ class SignalingSettingsWorker(context: Context, workerParams: WorkerParameters)
|
||||
userEntity = userEntityList[i]
|
||||
val finalUserEntity: UserNgEntity? = userEntity
|
||||
ncApi.getSignalingSettings(
|
||||
userEntity!!.getCredentials(),
|
||||
ApiUtils.getUrlForSignalingSettings(userEntity.baseUrl))
|
||||
userEntity!!.getCredentials(),
|
||||
ApiUtils.getUrlForSignalingSettings(userEntity.baseUrl))
|
||||
.blockingSubscribe(object : Observer<SignalingSettingsOverall> {
|
||||
override fun onSubscribe(d: Disposable) {}
|
||||
override fun onNext(signalingSettingsOverall: SignalingSettingsOverall) {
|
||||
@ -70,18 +70,18 @@ class SignalingSettingsWorker(context: Context, workerParams: WorkerParameters)
|
||||
externalSignalingServer = ExternalSignalingServer()
|
||||
externalSignalingServer.externalSignalingServer = signalingSettingsOverall.ocs.signalingSettings.externalSignalingServer
|
||||
externalSignalingServer.externalSignalingTicket = signalingSettingsOverall.ocs.signalingSettings.externalSignalingTicket
|
||||
val user = usersRepository.getUserWithId(userEntity.id!!)
|
||||
val user = usersRepository.getUserWithId(userEntity.id)
|
||||
//user.externalSignaling = externalSignalingServer
|
||||
runBlocking {
|
||||
val result = usersRepository.updateUser(user)
|
||||
eventBus.post(EventStatus(user.id!!,
|
||||
eventBus.post(EventStatus(user.id,
|
||||
EventStatus.EventType.SIGNALING_SETTINGS, result > 0))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
eventBus.post(EventStatus(finalUserEntity!!.id!!,
|
||||
eventBus.post(EventStatus(finalUserEntity!!.id,
|
||||
EventStatus.EventType.SIGNALING_SETTINGS, false))
|
||||
}
|
||||
|
||||
|
@ -32,9 +32,9 @@ import org.parceler.Parcel
|
||||
@JsonObject
|
||||
@Serializable
|
||||
@Parcelize
|
||||
data class SignatureVerification (
|
||||
@JvmField
|
||||
var signatureValid: Boolean = false,
|
||||
@JvmField
|
||||
var userEntity: UserNgEntity? = null
|
||||
): Parcelable
|
||||
data class SignatureVerification(
|
||||
@JvmField
|
||||
var signatureValid: Boolean = false,
|
||||
@JvmField
|
||||
var userEntity: UserNgEntity? = null
|
||||
) : Parcelable
|
@ -47,66 +47,84 @@ class ChatMessage : IMessage, MessageContentType, MessageContentType.Image {
|
||||
@JsonIgnore
|
||||
@Ignore
|
||||
var grouped = false
|
||||
|
||||
@JvmField
|
||||
@JsonIgnore
|
||||
@Ignore
|
||||
var oneToOneConversation = false
|
||||
|
||||
@JvmField
|
||||
@JsonIgnore
|
||||
@Ignore
|
||||
var activeUser: UserNgEntity? = null
|
||||
|
||||
@JvmField
|
||||
@JsonIgnore
|
||||
@Ignore
|
||||
var selectedIndividualHashMap: Map<String, String>? = null
|
||||
|
||||
@JvmField
|
||||
@JsonIgnore
|
||||
@Ignore
|
||||
var isLinkPreviewAllowed = false
|
||||
|
||||
@JvmField
|
||||
@JsonIgnore
|
||||
var internalMessageId: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonIgnore
|
||||
var internalConversationId: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["id"])
|
||||
@Ignore
|
||||
var jsonMessageId: Long? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["token"])
|
||||
var token: String? = null
|
||||
|
||||
// guests or users
|
||||
@JvmField
|
||||
@JsonField(name = ["actorType"])
|
||||
var actorType: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["actorId"])
|
||||
var actorId: String? = null
|
||||
|
||||
// send when crafting a message
|
||||
@JvmField
|
||||
@JsonField(name = ["actorDisplayName"])
|
||||
var actorDisplayName: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["timestamp"])
|
||||
var timestamp: Long = 0
|
||||
|
||||
// send when crafting a message, max 1000 lines
|
||||
@JvmField
|
||||
@JsonField(name = ["message"])
|
||||
var message: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["messageParameters"])
|
||||
@Ignore
|
||||
var messageParameters: HashMap<String, HashMap<String, String>>? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["systemMessage"], typeConverter = EnumSystemMessageTypeConverter::class)
|
||||
var systemMessageType: SystemMessageType? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["isReplyable"])
|
||||
var replyable = false
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["parent"])
|
||||
var parentMessage: ChatMessage? = null
|
||||
|
||||
@JvmField
|
||||
@JsonIgnore
|
||||
@Ignore
|
||||
|
@ -43,68 +43,95 @@ import java.util.*
|
||||
class Conversation {
|
||||
@JsonIgnore
|
||||
var databaseId: String? = null
|
||||
|
||||
@JsonIgnore
|
||||
@NonNull
|
||||
var databaseUserId: Long? = null
|
||||
|
||||
@JsonField(name = ["id"])
|
||||
var conversationId: String? = null
|
||||
|
||||
@JsonField(name = ["token"])
|
||||
var token: String? = null
|
||||
|
||||
@JsonField(name = ["name"])
|
||||
var name: String? = null
|
||||
|
||||
@JsonField(name = ["displayName"])
|
||||
var displayName: String? = null
|
||||
|
||||
@JsonField(name = ["type"], typeConverter = EnumRoomTypeConverter::class)
|
||||
var type: ConversationType? = null
|
||||
|
||||
@JsonField(name = ["count"])
|
||||
var count: Long = 0
|
||||
|
||||
/*@JsonField(name = ["lastPing"])
|
||||
var lastPing: Long = 0*/
|
||||
@JsonField(name = ["numGuests"])
|
||||
var numberOfGuests: Long = 0
|
||||
|
||||
/*@JsonField(name = ["guestList"])
|
||||
var guestList: HashMap<String, HashMap<String, Any>>? = null*/
|
||||
@JsonField(name = ["participants"])
|
||||
var participants: HashMap<String, Participant>? = null
|
||||
|
||||
@JsonField(name = ["participantType"], typeConverter = EnumParticipantTypeConverter::class)
|
||||
var participantType: Participant.ParticipantType? = null
|
||||
|
||||
@JsonField(name = ["hasPassword"])
|
||||
var hasPassword: Boolean = false
|
||||
|
||||
@JsonField(name = ["sessionId"])
|
||||
var sessionId: String? = null
|
||||
|
||||
@JsonIgnore
|
||||
var password: String? = null
|
||||
|
||||
@JsonField(name = ["isFavorite"])
|
||||
var favorite: Boolean = false
|
||||
|
||||
@JsonField(name = ["lastActivity"])
|
||||
var lastActivity: Long = 0
|
||||
|
||||
@JsonField(name = ["unreadMessages"])
|
||||
var unreadMessages: Int = 0
|
||||
|
||||
@JsonField(name = ["unreadMention"])
|
||||
var unreadMention: Boolean = false
|
||||
|
||||
@JsonField(name = ["lastMessage"])
|
||||
var lastMessage: ChatMessage? = null
|
||||
|
||||
@JsonField(name = ["objectType"])
|
||||
var objectType: String? = null
|
||||
|
||||
@JsonField(name = ["notificationLevel"], typeConverter = EnumNotificationLevelConverter::class)
|
||||
var notificationLevel: NotificationLevel? = null
|
||||
|
||||
@JsonField(name = ["readOnly"], typeConverter = EnumReadOnlyConversationConverter::class)
|
||||
var conversationReadOnlyState:
|
||||
ConversationReadOnlyState? = null
|
||||
|
||||
@JsonField(name = ["lobbyState"], typeConverter = EnumLobbyStateConverter::class)
|
||||
var lobbyState: LobbyState? = null
|
||||
|
||||
@JsonField(name = ["lobbyTimer"])
|
||||
var lobbyTimer: Long? = 0
|
||||
|
||||
@JsonField(name = ["lastReadMessageId"])
|
||||
var lastReadMessageId: Long = 0
|
||||
|
||||
@JsonField(name = ["canStartCall"])
|
||||
var canStartCall: Boolean? = true
|
||||
|
||||
@JsonIgnore
|
||||
var changing: Boolean = false
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
val isPublic: Boolean = ConversationType.PUBLIC_CONVERSATION == type
|
||||
|
||||
@JsonIgnore
|
||||
val isGuest: Boolean =
|
||||
Participant.ParticipantType.GUEST == participantType ||
|
||||
|
@ -38,29 +38,37 @@ class Participant {
|
||||
@JvmField
|
||||
@JsonField(name = ["userId"])
|
||||
var userId: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["type", "participantType"], typeConverter = EnumParticipantTypeConverter::class)
|
||||
var type: ParticipantType? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["name"])
|
||||
var name: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["displayName"])
|
||||
var displayName: String? = null
|
||||
|
||||
/*@JsonField(name = "lastPing")
|
||||
public long lastPing;*/
|
||||
@JvmField
|
||||
@JsonField(name = ["sessionId"])
|
||||
var sessionId: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["conversationId"])
|
||||
var conversationId: Long = 0
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["inCall", "call"], typeConverter = EnumParticipantFlagsConverter::class)
|
||||
var participantFlags: ParticipantFlags? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["source"])
|
||||
var source: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonIgnore
|
||||
var selected = false
|
||||
|
@ -32,30 +32,39 @@ class DecryptedPushMessage {
|
||||
@JvmField
|
||||
@JsonField(name = ["app"])
|
||||
var app: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["type"])
|
||||
var type: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["subject"])
|
||||
var subject: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["id"])
|
||||
var id: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["nid"])
|
||||
var notificationId: Long? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["delete"])
|
||||
var delete = false
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["delete-all"])
|
||||
var deleteAll = false
|
||||
|
||||
@JvmField
|
||||
@JsonIgnore
|
||||
var notificationUser: NotificationUser? = null
|
||||
|
||||
@JvmField
|
||||
@JsonIgnore
|
||||
var text: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonIgnore
|
||||
var timestamp: Long = 0
|
||||
|
@ -32,6 +32,7 @@ class UserProfileData {
|
||||
@JvmField
|
||||
@JsonField(name = ["display-name", "displayname"])
|
||||
var displayName: String? = null
|
||||
|
||||
@JvmField
|
||||
@JsonField(name = ["id"])
|
||||
var userId: String? = null
|
||||
|
@ -72,22 +72,27 @@ data class ErrorModel(
|
||||
* error in connecting to repository (Server or Database)
|
||||
*/
|
||||
NO_CONNECTION,
|
||||
|
||||
/**
|
||||
* error in getting value (Json Error, Server Error, etc)
|
||||
*/
|
||||
BAD_RESPONSE,
|
||||
|
||||
/**
|
||||
* Time out error
|
||||
*/
|
||||
TIMEOUT,
|
||||
|
||||
/**
|
||||
* no data available in repository
|
||||
*/
|
||||
EMPTY_RESPONSE,
|
||||
|
||||
/**
|
||||
* an unexpected error
|
||||
*/
|
||||
NOT_DEFINED,
|
||||
|
||||
/**
|
||||
* bad credentials
|
||||
*/
|
||||
|
@ -43,10 +43,10 @@ import com.nextcloud.talk.newarch.data.source.remote.ApiErrorHandler
|
||||
import com.nextcloud.talk.newarch.data.source.remote.ApiService
|
||||
import com.nextcloud.talk.newarch.domain.repository.offline.UsersRepository
|
||||
import com.nextcloud.talk.newarch.domain.repository.online.NextcloudTalkRepository
|
||||
import com.nextcloud.talk.newarch.utils.NetworkComponents
|
||||
import com.nextcloud.talk.newarch.utils.NetworkUtils
|
||||
import com.nextcloud.talk.newarch.utils.NetworkUtils.GetProxyRunnable
|
||||
import com.nextcloud.talk.newarch.utils.NetworkUtils.MagicAuthenticator
|
||||
import com.nextcloud.talk.newarch.utils.NetworkComponents
|
||||
import com.nextcloud.talk.utils.LoggingUtils
|
||||
import com.nextcloud.talk.utils.preferences.AppPreferences
|
||||
import com.nextcloud.talk.utils.singletons.AvatarStatusCodeHolder
|
||||
|
@ -23,7 +23,6 @@
|
||||
package com.nextcloud.talk.newarch.features.account.loginentry
|
||||
|
||||
import android.app.Application
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.nextcloud.talk.models.LoginData
|
||||
|
@ -436,9 +436,9 @@ class ChatView : BaseView(), MessageHolders.ContentChecker<IMessage>, MessagesLi
|
||||
|
||||
private fun loadAvatar() {
|
||||
val avatarSize = DisplayUtils.convertDpToPixel(
|
||||
conversationVoiceCallMenuItem?.icon!!
|
||||
.intrinsicWidth.toFloat(), activity!!
|
||||
)
|
||||
conversationVoiceCallMenuItem?.icon!!
|
||||
.intrinsicWidth.toFloat(), activity!!
|
||||
)
|
||||
.toInt()
|
||||
|
||||
avatarSize.let {
|
||||
|
@ -57,7 +57,7 @@ class ChatViewModel constructor(application: Application,
|
||||
fun init(user: UserNgEntity, conversationToken: String, conversationPassword: String?) {
|
||||
viewModelScope.launch {
|
||||
this@ChatViewModel.user = user
|
||||
this@ChatViewModel.initConversation = conversationsRepository.getConversationForUserWithToken(user.id!!, conversationToken)
|
||||
this@ChatViewModel.initConversation = conversationsRepository.getConversationForUserWithToken(user.id, conversationToken)
|
||||
this@ChatViewModel.conversationPassword = conversationPassword
|
||||
globalService.getConversation(conversationToken, this@ChatViewModel)
|
||||
}
|
||||
@ -70,7 +70,7 @@ class ChatViewModel constructor(application: Application,
|
||||
override suspend fun gotConversationInfoForUser(userNgEntity: UserNgEntity, conversation: Conversation?, operationStatus: GlobalServiceInterface.OperationStatus) {
|
||||
if (operationStatus == GlobalServiceInterface.OperationStatus.STATUS_OK) {
|
||||
if (userNgEntity.id == user.id && conversation!!.token == initConversation?.token) {
|
||||
this.conversation.value = conversationsRepository.getConversationForUserWithToken(user.id!!, conversation.token!!)
|
||||
this.conversation.value = conversationsRepository.getConversationForUserWithToken(user.id, conversation.token!!)
|
||||
conversation.token?.let { conversationToken ->
|
||||
globalService.joinConversation(conversationToken, conversationPassword, this)
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ class ConversationsListView : BaseView() {
|
||||
bundle.putString(BundleKeys.KEY_ROOM_ID, conversation.conversationId)
|
||||
bundle.putParcelable(BundleKeys.KEY_ACTIVE_CONVERSATION, Parcels.wrap(conversation))
|
||||
ConductorRemapping.remapChatController(
|
||||
router, user.id!!, conversation.token!!,
|
||||
router, user.id, conversation.token!!,
|
||||
bundle, false
|
||||
)
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ class ConversationsListViewModel constructor(
|
||||
filterLiveData.value = null
|
||||
Transformations.switchMap(filterLiveData) { filter ->
|
||||
if (user != null) {
|
||||
conversationsRepository.getConversationsForUser(user.id!!, filter)
|
||||
conversationsRepository.getConversationsForUser(user.id, filter)
|
||||
} else {
|
||||
liveData {
|
||||
listOf<Conversation>()
|
||||
@ -99,7 +99,7 @@ class ConversationsListViewModel constructor(
|
||||
object : UseCaseResponse<GenericOverall> {
|
||||
override suspend fun onSuccess(result: GenericOverall) {
|
||||
conversationsRepository.deleteConversation(
|
||||
globalService.currentUserLiveData.value!!.id!!, conversation
|
||||
globalService.currentUserLiveData.value!!.id, conversation
|
||||
.conversationId!!
|
||||
)
|
||||
}
|
||||
@ -128,7 +128,7 @@ class ConversationsListViewModel constructor(
|
||||
object : UseCaseResponse<GenericOverall> {
|
||||
override suspend fun onSuccess(result: GenericOverall) {
|
||||
conversationsRepository.deleteConversation(
|
||||
globalService.currentUserLiveData.value!!.id!!, conversation
|
||||
globalService.currentUserLiveData.value!!.id, conversation
|
||||
.conversationId!!
|
||||
)
|
||||
}
|
||||
@ -159,7 +159,7 @@ class ConversationsListViewModel constructor(
|
||||
object : UseCaseResponse<GenericOverall> {
|
||||
override suspend fun onSuccess(result: GenericOverall) {
|
||||
conversationsRepository.setFavoriteValueForConversation(
|
||||
globalService.currentUserLiveData.value!!.id!!,
|
||||
globalService.currentUserLiveData.value!!.id,
|
||||
conversation.conversationId!!, favorite
|
||||
)
|
||||
}
|
||||
@ -202,7 +202,7 @@ class ConversationsListViewModel constructor(
|
||||
}
|
||||
|
||||
conversationsRepository.saveConversationsForUser(
|
||||
internalUserId!!,
|
||||
internalUserId,
|
||||
mutableList, true)
|
||||
messageData = ""
|
||||
conversationsLoadingLock.unlock()
|
||||
@ -223,7 +223,7 @@ class ConversationsListViewModel constructor(
|
||||
value: Boolean
|
||||
) {
|
||||
conversationsRepository.setChangingValueForConversation(
|
||||
globalService.currentUserLiveData.value!!.id!!, conversation
|
||||
globalService.currentUserLiveData.value!!.id, conversation
|
||||
.conversationId!!, value
|
||||
)
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import kotlinx.serialization.json.Json
|
||||
|
||||
class SignalingSettingsConverter {
|
||||
val json = Json(MagicJson.customJsonConfiguration)
|
||||
|
||||
@TypeConverter
|
||||
fun fromSignalingSettingsToString(signalingSettings: SignalingSettings?): String {
|
||||
return if (signalingSettings == null) {
|
||||
|
@ -57,6 +57,7 @@ abstract class TalkDatabase : RoomDatabase() {
|
||||
|
||||
companion object {
|
||||
private const val DB_NAME = "talk.db"
|
||||
|
||||
@Volatile
|
||||
private var INSTANCE: TalkDatabase? = null
|
||||
|
||||
|
@ -22,13 +22,13 @@ data class User(
|
||||
var clientCertificate: String? = null,
|
||||
var signalingSettings: SignalingSettings? = null,
|
||||
var status: UserStatus? = null
|
||||
): Parcelable
|
||||
) : Parcelable
|
||||
|
||||
fun User.toUserEntity() : UserNgEntity {
|
||||
fun User.toUserEntity(): UserNgEntity {
|
||||
var userNgEntity: UserNgEntity? = null
|
||||
this.id?.let {
|
||||
userNgEntity = UserNgEntity(it, userId, username, baseUrl)
|
||||
}?: run {
|
||||
} ?: run {
|
||||
userNgEntity = UserNgEntity(userId = this.userId, username = this.username, baseUrl = this.baseUrl)
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ data class UserNgEntity(
|
||||
}
|
||||
}
|
||||
|
||||
fun UserNgEntity.toUser() : User {
|
||||
fun UserNgEntity.toUser(): User {
|
||||
return User(this.id, this.userId, this.username, this.baseUrl, this.token, this.displayName, this.pushConfiguration, this.capabilities, this.clientCertificate, this.signalingSettings, this.status)
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,10 @@ package com.nextcloud.talk.newarch.local.models.other
|
||||
enum class UserStatus {
|
||||
// account that is NOT actively used by the UI, but might be used by background tasks
|
||||
DORMANT,
|
||||
|
||||
// currently active account
|
||||
ACTIVE,
|
||||
|
||||
// account that will be deleted in the near future
|
||||
PENDING_DELETE
|
||||
}
|
||||
|
@ -42,9 +42,9 @@ import com.nextcloud.talk.newarch.domain.usecases.GetParticipantsForCallUseCase
|
||||
import com.nextcloud.talk.newarch.domain.usecases.base.UseCaseResponse
|
||||
import com.nextcloud.talk.newarch.local.models.UserNgEntity
|
||||
import com.nextcloud.talk.newarch.local.models.toUser
|
||||
import com.nextcloud.talk.newarch.utils.NetworkComponents
|
||||
import com.nextcloud.talk.newarch.utils.Images
|
||||
import com.nextcloud.talk.newarch.utils.MagicJson
|
||||
import com.nextcloud.talk.newarch.utils.NetworkComponents
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.NotificationUtils
|
||||
import com.nextcloud.talk.utils.PushUtils
|
||||
@ -57,7 +57,6 @@ import org.koin.core.KoinComponent
|
||||
import org.koin.core.inject
|
||||
import org.koin.core.parameter.parametersOf
|
||||
import org.parceler.Parcels
|
||||
import retrofit2.Retrofit
|
||||
import java.security.InvalidKeyException
|
||||
import java.security.NoSuchAlgorithmException
|
||||
import java.security.PrivateKey
|
||||
@ -275,7 +274,7 @@ class CallService : Service(), KoinComponent, CoroutineScope {
|
||||
}
|
||||
}
|
||||
|
||||
private fun endIncomingConversation(triggerEventBus : Boolean) {
|
||||
private fun endIncomingConversation(triggerEventBus: Boolean) {
|
||||
activeNotification = ""
|
||||
stopForeground(true)
|
||||
if (triggerEventBus) {
|
||||
@ -291,7 +290,7 @@ class CallService : Service(), KoinComponent, CoroutineScope {
|
||||
getConversationUseCase.invoke(this, parametersOf(user, conversationToken), object : UseCaseResponse<ConversationOverall> {
|
||||
override suspend fun onSuccess(result: ConversationOverall) {
|
||||
val internalConversation = result.ocs.data
|
||||
conversationsRepository.saveConversationsForUser(user.id!!, listOf(internalConversation), false)
|
||||
conversationsRepository.saveConversationsForUser(user.id, listOf(internalConversation), false)
|
||||
conversation = result.ocs.data
|
||||
}
|
||||
|
||||
@ -309,7 +308,7 @@ class CallService : Service(), KoinComponent, CoroutineScope {
|
||||
endIncomingConversation(true)
|
||||
activeNotification = generatedNotificationId
|
||||
val notification = builder.build()
|
||||
notification.extras.putLong(BundleKeys.KEY_INTERNAL_USER_ID, user.id!!)
|
||||
notification.extras.putLong(BundleKeys.KEY_INTERNAL_USER_ID, user.id)
|
||||
notification.extras.putLong(BundleKeys.KEY_NOTIFICATION_ID, internalNotificationId)
|
||||
notification.flags = notification.flags or Notification.FLAG_INSISTENT
|
||||
startForeground(generatedNotificationId.hashCode(), notification)
|
||||
|
@ -71,7 +71,7 @@ class GlobalService constructor(usersRepository: UsersRepository,
|
||||
object : UseCaseResponse<ConversationOverall> {
|
||||
override suspend fun onSuccess(result: ConversationOverall) {
|
||||
currentUser?.let {
|
||||
conversationsRepository.saveConversationsForUser(it.id!!, listOf(result.ocs.data), false)
|
||||
conversationsRepository.saveConversationsForUser(it.id, listOf(result.ocs.data), false)
|
||||
globalServiceInterface.gotConversationInfoForUser(it, result.ocs.data, GlobalServiceInterface.OperationStatus.STATUS_OK)
|
||||
}
|
||||
}
|
||||
@ -94,8 +94,8 @@ class GlobalService constructor(usersRepository: UsersRepository,
|
||||
object : UseCaseResponse<ConversationOverall> {
|
||||
override suspend fun onSuccess(result: ConversationOverall) {
|
||||
currentUser?.let {
|
||||
conversationsRepository.saveConversationsForUser(it.id!!, listOf(result.ocs.data), false)
|
||||
currentConversation = conversationsRepository.getConversationForUserWithToken(it.id!!, result.ocs!!.data!!.token!!)
|
||||
conversationsRepository.saveConversationsForUser(it.id, listOf(result.ocs.data), false)
|
||||
currentConversation = conversationsRepository.getConversationForUserWithToken(it.id, result.ocs!!.data!!.token!!)
|
||||
globalServiceInterface.joinedConversationForUser(it, currentConversation, GlobalServiceInterface.OperationStatus.STATUS_OK)
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class ShortcutService constructor(private var context: Context,
|
||||
currentUser = user
|
||||
var internalUserId: Long = -1
|
||||
currentUser?.let {
|
||||
internalUserId = it.id!!
|
||||
internalUserId = it.id
|
||||
}
|
||||
conversationsRepository.getShortcutTargetConversations(internalUserId)
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ class NetworkComponents(
|
||||
private val retrofit: Retrofit,
|
||||
private val androidApplication: Application
|
||||
) : KoinComponent {
|
||||
val usersSingleOperationRepositoryMap : MutableMap<Long, NextcloudTalkRepository> = mutableMapOf()
|
||||
val usersMultipleOperationsRepositoryMap : MutableMap<Long, NextcloudTalkRepository> = mutableMapOf()
|
||||
val usersSingleOperationRepositoryMap: MutableMap<Long, NextcloudTalkRepository> = mutableMapOf()
|
||||
val usersMultipleOperationsRepositoryMap: MutableMap<Long, NextcloudTalkRepository> = mutableMapOf()
|
||||
val usersSingleOperationOkHttpMap: MutableMap<Long, OkHttpClient> = mutableMapOf()
|
||||
val usersMultipleOperationOkHttpMap: MutableMap<Long, OkHttpClient> = mutableMapOf()
|
||||
|
||||
|
@ -79,8 +79,8 @@ class MentionAutocompletePresenter : RecyclerViewPresenter<Mention?>, FlexibleAd
|
||||
}
|
||||
adapter!!.setFilter(queryString)
|
||||
ncApi.getMentionAutocompleteSuggestions(
|
||||
currentUser!!.getCredentials(), ApiUtils.getUrlForMentionSuggestions(currentUser!!.baseUrl, roomToken),
|
||||
queryString, 5)
|
||||
currentUser!!.getCredentials(), ApiUtils.getUrlForMentionSuggestions(currentUser!!.baseUrl, roomToken),
|
||||
queryString, 5)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.retry(3)
|
||||
|
@ -129,11 +129,11 @@ object DisplayUtils {
|
||||
context: Context
|
||||
): Float {
|
||||
return Math.round(
|
||||
TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP, dp,
|
||||
context.resources.displayMetrics
|
||||
) + 0.5f
|
||||
)
|
||||
TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP, dp,
|
||||
context.resources.displayMetrics
|
||||
) + 0.5f
|
||||
)
|
||||
.toFloat()
|
||||
}
|
||||
|
||||
@ -272,9 +272,9 @@ object DisplayUtils {
|
||||
val stringText = text.toString()
|
||||
|
||||
val m = Pattern.compile(
|
||||
"@$label",
|
||||
Pattern.CASE_INSENSITIVE or Pattern.LITERAL or Pattern.MULTILINE
|
||||
)
|
||||
"@$label",
|
||||
Pattern.CASE_INSENSITIVE or Pattern.LITERAL or Pattern.MULTILINE
|
||||
)
|
||||
.matcher(spannableString)
|
||||
|
||||
val clickableSpan = object : ClickableSpan() {
|
||||
@ -319,9 +319,9 @@ object DisplayUtils {
|
||||
}
|
||||
|
||||
val m = Pattern.compile(
|
||||
searchText,
|
||||
Pattern.CASE_INSENSITIVE or Pattern.LITERAL or Pattern.MULTILINE
|
||||
)
|
||||
searchText,
|
||||
Pattern.CASE_INSENSITIVE or Pattern.LITERAL or Pattern.MULTILINE
|
||||
)
|
||||
.matcher(spannableString)
|
||||
|
||||
val textSize = NextcloudTalkApplication.sharedApplication!!
|
||||
|
@ -95,16 +95,16 @@ class DatabaseStorageModule(
|
||||
else -> 0
|
||||
}
|
||||
ncApi.setNotificationLevel(
|
||||
ApiUtils.getCredentials(
|
||||
conversationUser.username,
|
||||
conversationUser.token
|
||||
),
|
||||
ApiUtils.getUrlForSettingNotificationlevel(
|
||||
conversationUser.baseUrl,
|
||||
conversationToken
|
||||
),
|
||||
intValue
|
||||
)
|
||||
ApiUtils.getCredentials(
|
||||
conversationUser.username,
|
||||
conversationUser.token
|
||||
),
|
||||
ApiUtils.getUrlForSettingNotificationlevel(
|
||||
conversationUser.baseUrl,
|
||||
conversationToken
|
||||
),
|
||||
intValue
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(object : Observer<GenericOverall> {
|
||||
override fun onSubscribe(d: Disposable) {}
|
||||
@ -122,15 +122,15 @@ class DatabaseStorageModule(
|
||||
} else if (key == "conversation_password") {
|
||||
if (hasPassword != null) {
|
||||
ncApi.setPassword(
|
||||
ApiUtils.getCredentials(
|
||||
conversationUser.username,
|
||||
conversationUser.token
|
||||
),
|
||||
ApiUtils.getUrlForPassword(
|
||||
conversationUser.baseUrl,
|
||||
conversationToken
|
||||
), value
|
||||
)
|
||||
ApiUtils.getCredentials(
|
||||
conversationUser.username,
|
||||
conversationUser.token
|
||||
),
|
||||
ApiUtils.getUrlForPassword(
|
||||
conversationUser.baseUrl,
|
||||
conversationToken
|
||||
), value
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(object : Observer<GenericOverall> {
|
||||
override fun onSubscribe(d: Disposable) {}
|
||||
@ -151,14 +151,14 @@ class DatabaseStorageModule(
|
||||
) && conversationNameValue != value
|
||||
) {
|
||||
ncApi.renameRoom(
|
||||
ApiUtils.getCredentials(
|
||||
conversationUser.username,
|
||||
conversationUser.token
|
||||
), ApiUtils.getRoom(
|
||||
conversationUser.baseUrl,
|
||||
conversationToken
|
||||
), value
|
||||
)
|
||||
ApiUtils.getCredentials(
|
||||
conversationUser.username,
|
||||
conversationUser.token
|
||||
), ApiUtils.getRoom(
|
||||
conversationUser.baseUrl,
|
||||
conversationToken
|
||||
), value
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(object : Observer<GenericOverall> {
|
||||
override fun onSubscribe(d: Disposable) {}
|
||||
@ -263,6 +263,6 @@ class DatabaseStorageModule(
|
||||
override fun onRestoreInstanceState(savedState: Bundle) {}
|
||||
|
||||
init {
|
||||
accountIdentifier = conversationUser.id!!
|
||||
accountIdentifier = conversationUser.id
|
||||
}
|
||||
}
|
@ -242,7 +242,7 @@ class MagicWebSocketInstance internal constructor(
|
||||
HashMap<String, String?>()
|
||||
refreshChatHashMap[KEY_CONVERSATION_TOKEN] = messageHashMap["roomid"] as String?
|
||||
refreshChatHashMap[KEY_INTERNAL_USER_ID] =
|
||||
java.lang.Long.toString(conversationUser.id!!)
|
||||
java.lang.Long.toString(conversationUser.id)
|
||||
eventBus.post(
|
||||
WebSocketCommunicationEvent("refreshChat", refreshChatHashMap)
|
||||
)
|
||||
|
@ -102,6 +102,7 @@ class WebSocketConnectionHelper : KoinComponent {
|
||||
|
||||
companion object {
|
||||
private val magicWebSocketInstanceMap: MutableMap<Long, MagicWebSocketInstance> = HashMap()
|
||||
|
||||
@Synchronized
|
||||
fun getMagicWebSocketInstanceForUserId(
|
||||
userId: Long): MagicWebSocketInstance? {
|
||||
@ -128,7 +129,7 @@ class WebSocketConnectionHelper : KoinComponent {
|
||||
deleteExternalSignalingInstanceForUserEntity(userId)
|
||||
}
|
||||
magicWebSocketInstance = MagicWebSocketInstance(userEntity, generatedURL, webSocketTicket!!)
|
||||
magicWebSocketInstanceMap[userEntity.id!!] = magicWebSocketInstance
|
||||
magicWebSocketInstanceMap[userEntity.id] = magicWebSocketInstance
|
||||
return magicWebSocketInstance
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user