2019-09-09 20:59:40 +01:00
|
|
|
/*
|
2022-06-18 15:42:35 +01:00
|
|
|
* Nextcloud Talk application
|
2019-09-09 20:59:40 +01:00
|
|
|
*
|
2022-06-18 15:42:35 +01:00
|
|
|
* @author Mario Danic
|
|
|
|
* @author Andy Scherzinger
|
|
|
|
* Copyright (C) 2021 Andy Scherzinger (infoi@andy-scherzinger.de)
|
|
|
|
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
|
2019-09-09 20:59:40 +01:00
|
|
|
*
|
2022-06-18 15:42:35 +01:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* at your option) any later version.
|
2019-09-09 20:59:40 +01:00
|
|
|
*
|
2022-06-18 15:42:35 +01:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2019-09-09 20:59:40 +01:00
|
|
|
*
|
2022-06-18 15:42:35 +01:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2019-09-09 20:59:40 +01:00
|
|
|
*/
|
|
|
|
package com.nextcloud.talk.activities
|
|
|
|
|
|
|
|
import android.app.KeyguardManager
|
|
|
|
import android.content.Context
|
|
|
|
import android.content.Intent
|
|
|
|
import android.os.Build
|
|
|
|
import android.os.Bundle
|
2020-11-12 11:43:17 +00:00
|
|
|
import android.provider.ContactsContract
|
2020-10-09 09:42:23 +01:00
|
|
|
import android.text.TextUtils
|
2022-01-09 21:56:47 +00:00
|
|
|
import android.util.Log
|
2019-09-09 20:59:40 +01:00
|
|
|
import androidx.annotation.RequiresApi
|
|
|
|
import autodagger.AutoInjector
|
|
|
|
import com.bluelinelabs.conductor.Conductor
|
|
|
|
import com.bluelinelabs.conductor.Router
|
|
|
|
import com.bluelinelabs.conductor.RouterTransaction
|
|
|
|
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler
|
|
|
|
import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler
|
2020-11-12 11:43:17 +00:00
|
|
|
import com.google.android.material.snackbar.Snackbar
|
2019-09-09 20:59:40 +01:00
|
|
|
import com.nextcloud.talk.R
|
2020-11-12 11:43:17 +00:00
|
|
|
import com.nextcloud.talk.api.NcApi
|
2019-09-09 20:59:40 +01:00
|
|
|
import com.nextcloud.talk.application.NextcloudTalkApplication
|
2021-03-29 23:35:40 +01:00
|
|
|
import com.nextcloud.talk.controllers.ConversationsListController
|
|
|
|
import com.nextcloud.talk.controllers.LockedController
|
|
|
|
import com.nextcloud.talk.controllers.ServerSelectionController
|
2021-05-11 00:02:45 +01:00
|
|
|
import com.nextcloud.talk.controllers.SettingsController
|
2021-03-29 23:35:40 +01:00
|
|
|
import com.nextcloud.talk.controllers.WebViewLoginController
|
2019-09-09 20:59:40 +01:00
|
|
|
import com.nextcloud.talk.controllers.base.providers.ActionBarProvider
|
2022-06-23 19:10:09 +01:00
|
|
|
import com.nextcloud.talk.data.user.model.User
|
2021-05-18 16:58:09 +01:00
|
|
|
import com.nextcloud.talk.databinding.ActivityMainBinding
|
2020-11-12 11:43:17 +00:00
|
|
|
import com.nextcloud.talk.models.json.conversations.RoomOverall
|
2022-06-22 18:53:53 +01:00
|
|
|
import com.nextcloud.talk.users.UserManager
|
2020-11-12 11:43:17 +00:00
|
|
|
import com.nextcloud.talk.utils.ApiUtils
|
|
|
|
import com.nextcloud.talk.utils.ConductorRemapping.remapChatController
|
2019-09-09 20:59:40 +01:00
|
|
|
import com.nextcloud.talk.utils.SecurityUtils
|
|
|
|
import com.nextcloud.talk.utils.bundle.BundleKeys
|
2020-11-12 11:43:17 +00:00
|
|
|
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ACTIVE_CONVERSATION
|
|
|
|
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID
|
|
|
|
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
|
|
|
|
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_USER_ENTITY
|
|
|
|
import io.reactivex.Observer
|
2022-06-23 19:10:09 +01:00
|
|
|
import io.reactivex.SingleObserver
|
2020-11-12 11:43:17 +00:00
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
|
|
import io.reactivex.disposables.Disposable
|
|
|
|
import io.reactivex.schedulers.Schedulers
|
2019-09-09 20:59:40 +01:00
|
|
|
import io.requery.Persistable
|
|
|
|
import io.requery.android.sqlcipher.SqlCipherDatabaseSource
|
|
|
|
import io.requery.reactivex.ReactiveEntityStore
|
2020-11-12 11:43:17 +00:00
|
|
|
import org.parceler.Parcels
|
2019-09-09 20:59:40 +01:00
|
|
|
import javax.inject.Inject
|
|
|
|
|
|
|
|
@AutoInjector(NextcloudTalkApplication::class)
|
|
|
|
class MainActivity : BaseActivity(), ActionBarProvider {
|
2021-05-18 16:58:09 +01:00
|
|
|
lateinit var binding: ActivityMainBinding
|
2019-09-09 20:59:40 +01:00
|
|
|
|
|
|
|
@Inject
|
|
|
|
lateinit var dataStore: ReactiveEntityStore<Persistable>
|
2021-04-27 15:32:08 +01:00
|
|
|
|
2019-09-09 20:59:40 +01:00
|
|
|
@Inject
|
|
|
|
lateinit var sqlCipherDatabaseSource: SqlCipherDatabaseSource
|
2021-04-27 15:32:08 +01:00
|
|
|
|
2020-11-12 11:43:17 +00:00
|
|
|
@Inject
|
|
|
|
lateinit var ncApi: NcApi
|
2019-09-09 20:59:40 +01:00
|
|
|
|
2022-06-19 21:17:21 +01:00
|
|
|
@Inject
|
2022-06-22 18:53:53 +01:00
|
|
|
lateinit var userManager: UserManager
|
2022-06-19 21:17:21 +01:00
|
|
|
|
2019-09-09 20:59:40 +01:00
|
|
|
private var router: Router? = null
|
|
|
|
|
2022-03-10 17:44:37 +00:00
|
|
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
2019-09-09 20:59:40 +01:00
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
2022-01-09 21:56:47 +00:00
|
|
|
Log.d(TAG, "onCreate: Activity: " + System.identityHashCode(this).toString())
|
|
|
|
|
2019-09-09 20:59:40 +01:00
|
|
|
super.onCreate(savedInstanceState)
|
2021-04-14 23:29:29 +01:00
|
|
|
// Set the default theme to replace the launch screen theme.
|
|
|
|
setTheme(R.style.AppTheme)
|
2021-05-18 16:58:09 +01:00
|
|
|
binding = ActivityMainBinding.inflate(layoutInflater)
|
|
|
|
setContentView(binding.root)
|
2019-09-09 20:59:40 +01:00
|
|
|
|
|
|
|
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
|
|
|
|
|
2021-05-18 16:58:09 +01:00
|
|
|
setSupportActionBar(binding.toolbar)
|
2019-09-09 20:59:40 +01:00
|
|
|
|
2021-05-18 16:58:09 +01:00
|
|
|
router = Conductor.attachRouter(this, binding.controllerContainer, savedInstanceState)
|
2019-09-09 20:59:40 +01:00
|
|
|
|
|
|
|
var hasDb = true
|
|
|
|
|
|
|
|
try {
|
|
|
|
sqlCipherDatabaseSource.writableDatabase
|
|
|
|
} catch (exception: Exception) {
|
|
|
|
hasDb = false
|
|
|
|
}
|
|
|
|
|
|
|
|
if (intent.hasExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
|
|
|
|
onNewIntent(intent)
|
|
|
|
} else if (!router!!.hasRootController()) {
|
|
|
|
if (hasDb) {
|
2022-06-20 18:55:37 +01:00
|
|
|
if (!appPreferences.isDbRoomMigrated) {
|
|
|
|
appPreferences.isDbRoomMigrated = true
|
|
|
|
}
|
2022-06-22 18:53:53 +01:00
|
|
|
|
2022-06-23 19:10:09 +01:00
|
|
|
userManager.users.subscribe(object : SingleObserver<List<User>> {
|
2022-06-22 18:53:53 +01:00
|
|
|
override fun onSubscribe(d: Disposable) {
|
|
|
|
// unused atm
|
|
|
|
}
|
|
|
|
|
2022-06-23 19:10:09 +01:00
|
|
|
override fun onSuccess(users: List<User>) {
|
2022-06-22 18:53:53 +01:00
|
|
|
if (users.isNotEmpty()) {
|
2022-06-20 17:33:19 +01:00
|
|
|
runOnUiThread {
|
|
|
|
setDefaultRootController()
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
runOnUiThread {
|
|
|
|
launchLoginScreen()
|
|
|
|
}
|
2022-06-20 12:28:16 +01:00
|
|
|
}
|
|
|
|
}
|
2022-06-22 18:53:53 +01:00
|
|
|
|
|
|
|
override fun onError(e: Throwable) {
|
2022-06-23 19:10:09 +01:00
|
|
|
Log.e(TAG, "Error loading existing users", e)
|
2022-06-22 18:53:53 +01:00
|
|
|
}
|
|
|
|
})
|
2020-10-09 09:42:23 +01:00
|
|
|
} else {
|
2022-04-28 20:18:29 +01:00
|
|
|
launchLoginScreen()
|
2019-09-09 20:59:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-28 20:18:29 +01:00
|
|
|
private fun launchLoginScreen() {
|
|
|
|
if (!TextUtils.isEmpty(resources.getString(R.string.weblogin_url))) {
|
|
|
|
router!!.pushController(
|
|
|
|
RouterTransaction.with(
|
|
|
|
WebViewLoginController(resources.getString(R.string.weblogin_url), false)
|
|
|
|
)
|
|
|
|
.pushChangeHandler(HorizontalChangeHandler())
|
|
|
|
.popChangeHandler(HorizontalChangeHandler())
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
router!!.setRoot(
|
|
|
|
RouterTransaction.with(ServerSelectionController())
|
|
|
|
.pushChangeHandler(HorizontalChangeHandler())
|
|
|
|
.popChangeHandler(HorizontalChangeHandler())
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-09 20:59:40 +01:00
|
|
|
override fun onStart() {
|
2022-01-09 21:56:47 +00:00
|
|
|
Log.d(TAG, "onStart: Activity: " + System.identityHashCode(this).toString())
|
|
|
|
|
2019-09-09 20:59:40 +01:00
|
|
|
super.onStart()
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
|
|
checkIfWeAreSecure()
|
|
|
|
}
|
2021-04-27 15:32:08 +01:00
|
|
|
|
2020-11-12 11:43:17 +00:00
|
|
|
handleActionFromContact(intent)
|
|
|
|
}
|
|
|
|
|
2022-01-09 21:56:47 +00:00
|
|
|
override fun onResume() {
|
|
|
|
Log.d(TAG, "onResume: Activity: " + System.identityHashCode(this).toString())
|
|
|
|
super.onResume()
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onPause() {
|
|
|
|
Log.d(TAG, "onPause: Activity: " + System.identityHashCode(this).toString())
|
|
|
|
super.onPause()
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onStop() {
|
|
|
|
Log.d(TAG, "onStop: Activity: " + System.identityHashCode(this).toString())
|
|
|
|
super.onStop()
|
|
|
|
}
|
|
|
|
|
2022-04-02 19:58:07 +01:00
|
|
|
private fun setDefaultRootController() {
|
|
|
|
router!!.setRoot(
|
|
|
|
RouterTransaction.with(ConversationsListController(Bundle()))
|
|
|
|
.pushChangeHandler(HorizontalChangeHandler())
|
|
|
|
.popChangeHandler(HorizontalChangeHandler())
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-05-11 00:02:45 +01:00
|
|
|
fun resetConversationsList() {
|
2022-06-23 19:10:09 +01:00
|
|
|
userManager.users.subscribe(object : SingleObserver<List<User>> {
|
2022-06-22 18:53:53 +01:00
|
|
|
override fun onSubscribe(d: Disposable) {
|
2022-06-25 12:50:15 +01:00
|
|
|
// unused atm
|
2022-06-22 18:53:53 +01:00
|
|
|
}
|
|
|
|
|
2022-06-23 19:10:09 +01:00
|
|
|
override fun onSuccess(users: List<User>) {
|
2022-06-22 18:53:53 +01:00
|
|
|
if (users.isNotEmpty()) {
|
2022-06-20 17:33:19 +01:00
|
|
|
runOnUiThread {
|
|
|
|
setDefaultRootController()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-06-22 18:53:53 +01:00
|
|
|
|
|
|
|
override fun onError(e: Throwable) {
|
2022-06-23 19:10:09 +01:00
|
|
|
Log.e(TAG, "Error loading existing users", e)
|
2022-06-22 18:53:53 +01:00
|
|
|
}
|
|
|
|
})
|
2021-05-11 00:02:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fun openSettings() {
|
|
|
|
router!!.pushController(
|
|
|
|
RouterTransaction.with(SettingsController())
|
|
|
|
.pushChangeHandler(HorizontalChangeHandler())
|
|
|
|
.popChangeHandler(HorizontalChangeHandler())
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
fun addAccount() {
|
|
|
|
router!!.pushController(
|
|
|
|
RouterTransaction.with(ServerSelectionController())
|
|
|
|
.pushChangeHandler(VerticalChangeHandler())
|
|
|
|
.popChangeHandler(VerticalChangeHandler())
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-11-12 11:43:17 +00:00
|
|
|
private fun handleActionFromContact(intent: Intent) {
|
|
|
|
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
|
|
|
|
|
|
|
|
val cursor = contentResolver.query(intent.data!!, null, null, null, null)
|
|
|
|
|
|
|
|
var userId = ""
|
|
|
|
if (cursor != null) {
|
|
|
|
if (cursor.moveToFirst()) {
|
|
|
|
// userId @ server
|
2022-05-19 11:07:40 +01:00
|
|
|
userId = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Data.DATA1))
|
2020-11-12 11:43:17 +00:00
|
|
|
}
|
2021-04-27 15:32:08 +01:00
|
|
|
|
2020-11-12 11:43:17 +00:00
|
|
|
cursor.close()
|
|
|
|
}
|
|
|
|
|
|
|
|
when (intent.type) {
|
|
|
|
"vnd.android.cursor.item/vnd.com.nextcloud.talk2.chat" -> {
|
2021-03-17 09:24:13 +00:00
|
|
|
val user = userId.substringBeforeLast("@")
|
|
|
|
val baseUrl = userId.substringAfterLast("@")
|
2022-06-22 18:53:53 +01:00
|
|
|
|
2022-06-23 19:10:09 +01:00
|
|
|
if (userManager.currentUser.blockingGet()?.baseUrl?.endsWith(baseUrl) == true) {
|
2022-06-22 18:53:53 +01:00
|
|
|
startConversation(user)
|
|
|
|
} else {
|
|
|
|
Snackbar.make(
|
|
|
|
binding.controllerContainer,
|
|
|
|
R.string.nc_phone_book_integration_account_not_found,
|
|
|
|
Snackbar.LENGTH_LONG
|
|
|
|
).show()
|
2020-11-12 11:43:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-09 20:59:40 +01:00
|
|
|
}
|
2021-04-27 15:32:08 +01:00
|
|
|
|
2020-11-12 11:43:17 +00:00
|
|
|
private fun startConversation(userId: String) {
|
|
|
|
val roomType = "1"
|
2019-09-09 20:59:40 +01:00
|
|
|
|
2022-06-23 19:10:09 +01:00
|
|
|
val currentUser = userManager.currentUser.blockingGet()
|
2022-06-22 18:53:53 +01:00
|
|
|
|
|
|
|
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.APIv4, 1))
|
|
|
|
val credentials = ApiUtils.getCredentials(currentUser?.username, currentUser?.token)
|
|
|
|
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
|
|
|
|
apiVersion, currentUser?.baseUrl, roomType,
|
|
|
|
null, userId, null
|
|
|
|
)
|
|
|
|
|
|
|
|
ncApi.createRoom(
|
|
|
|
credentials,
|
|
|
|
retrofitBucket.url, retrofitBucket.queryMap
|
|
|
|
)
|
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
|
.subscribe(object : Observer<RoomOverall> {
|
|
|
|
override fun onSubscribe(d: Disposable) {
|
|
|
|
// unused atm
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onNext(roomOverall: RoomOverall) {
|
|
|
|
val bundle = Bundle()
|
|
|
|
bundle.putParcelable(KEY_USER_ENTITY, currentUser)
|
|
|
|
bundle.putString(KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
|
|
|
|
bundle.putString(KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
|
|
|
|
|
|
|
|
// FIXME once APIv2 or later is used only, the createRoom already returns all the data
|
|
|
|
ncApi.getRoom(
|
2021-05-08 13:27:01 +01:00
|
|
|
credentials,
|
2022-06-22 18:53:53 +01:00
|
|
|
ApiUtils.getUrlForRoom(
|
|
|
|
apiVersion,
|
|
|
|
currentUser?.baseUrl,
|
|
|
|
roomOverall.ocs!!.data!!.token
|
|
|
|
)
|
2021-05-08 13:27:01 +01:00
|
|
|
)
|
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
|
.subscribe(object : Observer<RoomOverall> {
|
2022-02-12 13:56:18 +00:00
|
|
|
override fun onSubscribe(d: Disposable) {
|
|
|
|
// unused atm
|
|
|
|
}
|
2022-06-20 17:33:19 +01:00
|
|
|
|
2021-05-08 13:27:01 +01:00
|
|
|
override fun onNext(roomOverall: RoomOverall) {
|
2022-06-22 18:53:53 +01:00
|
|
|
bundle.putParcelable(
|
|
|
|
KEY_ACTIVE_CONVERSATION,
|
|
|
|
Parcels.wrap(roomOverall.ocs!!.data)
|
|
|
|
)
|
|
|
|
remapChatController(
|
2022-06-23 19:10:09 +01:00
|
|
|
router!!, currentUser!!.id!!,
|
2022-06-22 18:53:53 +01:00
|
|
|
roomOverall.ocs!!.data!!.token!!, bundle, true
|
2021-05-08 13:27:01 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-02-12 13:56:18 +00:00
|
|
|
override fun onError(e: Throwable) {
|
|
|
|
// unused atm
|
|
|
|
}
|
2022-06-20 17:33:19 +01:00
|
|
|
|
2022-02-12 13:56:18 +00:00
|
|
|
override fun onComplete() {
|
|
|
|
// unused atm
|
|
|
|
}
|
2021-05-08 13:27:01 +01:00
|
|
|
})
|
2021-04-27 15:32:08 +01:00
|
|
|
}
|
2022-06-22 18:53:53 +01:00
|
|
|
|
|
|
|
override fun onError(e: Throwable) {
|
|
|
|
// unused atm
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onComplete() {
|
|
|
|
// unused atm
|
|
|
|
}
|
|
|
|
})
|
2020-11-12 11:43:17 +00:00
|
|
|
}
|
2019-09-09 20:59:40 +01:00
|
|
|
|
|
|
|
@RequiresApi(api = Build.VERSION_CODES.M)
|
|
|
|
fun checkIfWeAreSecure() {
|
|
|
|
val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
|
|
|
if (keyguardManager.isKeyguardSecure && appPreferences.isScreenLocked) {
|
|
|
|
if (!SecurityUtils.checkIfWeAreAuthenticated(appPreferences.screenLockTimeout)) {
|
|
|
|
if (router != null && router!!.getControllerWithTag(LockedController.TAG) == null) {
|
2021-04-27 15:32:08 +01:00
|
|
|
router!!.pushController(
|
|
|
|
RouterTransaction.with(LockedController())
|
2019-09-09 20:59:40 +01:00
|
|
|
.pushChangeHandler(VerticalChangeHandler())
|
|
|
|
.popChangeHandler(VerticalChangeHandler())
|
2021-04-27 15:32:08 +01:00
|
|
|
.tag(LockedController.TAG)
|
|
|
|
)
|
2019-09-09 20:59:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onNewIntent(intent: Intent) {
|
2022-01-09 21:56:47 +00:00
|
|
|
Log.d(TAG, "onNewIntent Activity: " + System.identityHashCode(this).toString())
|
2019-09-09 20:59:40 +01:00
|
|
|
super.onNewIntent(intent)
|
2020-11-12 11:43:17 +00:00
|
|
|
handleActionFromContact(intent)
|
2019-09-09 20:59:40 +01:00
|
|
|
if (intent.hasExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
|
|
|
|
if (intent.getBooleanExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL, false)) {
|
2022-04-02 19:58:07 +01:00
|
|
|
if (!router!!.hasRootController()) {
|
|
|
|
setDefaultRootController()
|
|
|
|
}
|
2021-10-28 11:19:07 +01:00
|
|
|
val callNotificationIntent = Intent(this, CallNotificationActivity::class.java)
|
|
|
|
intent.extras?.let { callNotificationIntent.putExtras(it) }
|
|
|
|
startActivity(callNotificationIntent)
|
2019-09-09 20:59:40 +01:00
|
|
|
} else {
|
2022-02-27 15:02:51 +00:00
|
|
|
remapChatController(
|
2022-07-24 13:19:20 +01:00
|
|
|
router!!, intent.getParcelableExtra<User>(KEY_USER_ENTITY)!!.id!!,
|
2022-03-10 20:55:41 +00:00
|
|
|
intent.getStringExtra(KEY_ROOM_TOKEN)!!, intent.extras!!, false, true
|
2021-04-27 15:32:08 +01:00
|
|
|
)
|
2019-09-09 20:59:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onBackPressed() {
|
|
|
|
if (router!!.getControllerWithTag(LockedController.TAG) != null) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!router!!.handleBack()) {
|
|
|
|
super.onBackPressed()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
companion object {
|
2022-06-20 17:33:19 +01:00
|
|
|
private const val TAG = "MainActivity"
|
2019-09-09 20:59:40 +01:00
|
|
|
}
|
|
|
|
}
|