Open matrix.to with a loader

This commit is contained in:
ganfra 2019-11-25 17:27:38 +01:00 committed by Benoit Marty
parent abf0796794
commit bc568343a2
3 changed files with 13 additions and 3 deletions

View file

@ -69,7 +69,7 @@ class PermalinkHandler @Inject constructor(private val session: Session,
}
is PermalinkData.UserLink -> {
navigator.openUserDetail(permalinkData.userId, context, buildTask)
Single.just(false)
Single.just(true)
}
is PermalinkData.FallbackLink -> {
Single.just(false)

View file

@ -18,14 +18,19 @@ package im.vector.riotx.features.permalink
import android.content.Intent
import android.os.Bundle
import im.vector.matrix.android.api.session.room.timeline.TimelineEvent
import im.vector.riotx.R
import im.vector.riotx.core.di.ActiveSessionHolder
import im.vector.riotx.core.di.ScreenComponent
import im.vector.riotx.core.extensions.replaceFragment
import im.vector.riotx.core.platform.VectorBaseActivity
import im.vector.riotx.core.utils.toast
import im.vector.riotx.features.home.LoadingFragment
import im.vector.riotx.features.login.LoginActivity
import io.reactivex.Single
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.android.synthetic.debug.activity_test_material_theme.*
import java.util.concurrent.TimeUnit
import javax.inject.Inject
class PermalinkHandlerActivity : VectorBaseActivity() {
@ -39,7 +44,10 @@ class PermalinkHandlerActivity : VectorBaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity)
setContentView(R.layout.activity_simple)
if (isFirstCreation()) {
replaceFragment(R.id.simpleFragmentContainer, LoadingFragment::class.java)
}
// If we are not logged in, open login screen.
// In the future, we might want to relaunch the process after login.
if (!sessionHolder.hasActiveSession()) {
@ -48,10 +56,11 @@ class PermalinkHandlerActivity : VectorBaseActivity() {
}
val uri = intent.dataString
permalinkHandler.launch(this, uri, buildTask = true)
.delay(500, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe { isHandled ->
if (!isHandled) {
toast("Your matrix.to link was malformed")
toast(R.string.permalink_malformed)
}
finish()
}

View file

@ -1800,5 +1800,6 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming
<string name="permissions_rationale_msg_keys_backup_export">Riot needs permission to save your E2E keys on disk.\n\nPlease allow access on the next pop-up to be able to export your keys manually.</string>
<string name="no_network_indicator">There is no network connection right now</string>
<string name="permalink_malformed">Your matrix.to link was malformed</string>
</resources>