mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 21:48:50 +03:00
Open matrix.to with a loader
This commit is contained in:
parent
abf0796794
commit
bc568343a2
3 changed files with 13 additions and 3 deletions
|
@ -69,7 +69,7 @@ class PermalinkHandler @Inject constructor(private val session: Session,
|
||||||
}
|
}
|
||||||
is PermalinkData.UserLink -> {
|
is PermalinkData.UserLink -> {
|
||||||
navigator.openUserDetail(permalinkData.userId, context, buildTask)
|
navigator.openUserDetail(permalinkData.userId, context, buildTask)
|
||||||
Single.just(false)
|
Single.just(true)
|
||||||
}
|
}
|
||||||
is PermalinkData.FallbackLink -> {
|
is PermalinkData.FallbackLink -> {
|
||||||
Single.just(false)
|
Single.just(false)
|
||||||
|
|
|
@ -18,14 +18,19 @@ package im.vector.riotx.features.permalink
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import im.vector.matrix.android.api.session.room.timeline.TimelineEvent
|
||||||
import im.vector.riotx.R
|
import im.vector.riotx.R
|
||||||
import im.vector.riotx.core.di.ActiveSessionHolder
|
import im.vector.riotx.core.di.ActiveSessionHolder
|
||||||
import im.vector.riotx.core.di.ScreenComponent
|
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.platform.VectorBaseActivity
|
||||||
import im.vector.riotx.core.utils.toast
|
import im.vector.riotx.core.utils.toast
|
||||||
|
import im.vector.riotx.features.home.LoadingFragment
|
||||||
import im.vector.riotx.features.login.LoginActivity
|
import im.vector.riotx.features.login.LoginActivity
|
||||||
|
import io.reactivex.Single
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import kotlinx.android.synthetic.debug.activity_test_material_theme.*
|
import kotlinx.android.synthetic.debug.activity_test_material_theme.*
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class PermalinkHandlerActivity : VectorBaseActivity() {
|
class PermalinkHandlerActivity : VectorBaseActivity() {
|
||||||
|
@ -39,7 +44,10 @@ class PermalinkHandlerActivity : VectorBaseActivity() {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
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.
|
// If we are not logged in, open login screen.
|
||||||
// In the future, we might want to relaunch the process after login.
|
// In the future, we might want to relaunch the process after login.
|
||||||
if (!sessionHolder.hasActiveSession()) {
|
if (!sessionHolder.hasActiveSession()) {
|
||||||
|
@ -48,10 +56,11 @@ class PermalinkHandlerActivity : VectorBaseActivity() {
|
||||||
}
|
}
|
||||||
val uri = intent.dataString
|
val uri = intent.dataString
|
||||||
permalinkHandler.launch(this, uri, buildTask = true)
|
permalinkHandler.launch(this, uri, buildTask = true)
|
||||||
|
.delay(500, TimeUnit.MILLISECONDS)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe { isHandled ->
|
.subscribe { isHandled ->
|
||||||
if (!isHandled) {
|
if (!isHandled) {
|
||||||
toast("Your matrix.to link was malformed")
|
toast(R.string.permalink_malformed)
|
||||||
}
|
}
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
|
@ -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="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="no_network_indicator">There is no network connection right now</string>
|
||||||
|
<string name="permalink_malformed">Your matrix.to link was malformed</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue