From bc568343a23be38bd3f0866b23c8688510839d20 Mon Sep 17 00:00:00 2001 From: ganfra Date: Mon, 25 Nov 2019 17:27:38 +0100 Subject: [PATCH] Open matrix.to with a loader --- .../riotx/features/permalink/PermalinkHandler.kt | 2 +- .../features/permalink/PermalinkHandlerActivity.kt | 13 +++++++++++-- vector/src/main/res/values/strings.xml | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/permalink/PermalinkHandler.kt b/vector/src/main/java/im/vector/riotx/features/permalink/PermalinkHandler.kt index 34f11378e7..c849166738 100644 --- a/vector/src/main/java/im/vector/riotx/features/permalink/PermalinkHandler.kt +++ b/vector/src/main/java/im/vector/riotx/features/permalink/PermalinkHandler.kt @@ -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) diff --git a/vector/src/main/java/im/vector/riotx/features/permalink/PermalinkHandlerActivity.kt b/vector/src/main/java/im/vector/riotx/features/permalink/PermalinkHandlerActivity.kt index 26d8d04cda..026991b859 100644 --- a/vector/src/main/java/im/vector/riotx/features/permalink/PermalinkHandlerActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/permalink/PermalinkHandlerActivity.kt @@ -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() } diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 2e4d04354b..9f8fd7cb1b 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -1800,5 +1800,6 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming 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. There is no network connection right now + Your matrix.to link was malformed