moving the soft logout activity starting to the navigator
This commit is contained in:
parent
1aa532178e
commit
a2a89c1ee8
|
@ -41,8 +41,6 @@ import im.vector.app.features.pin.UnlockedActivity
|
||||||
import im.vector.app.features.popup.PopupAlertManager
|
import im.vector.app.features.popup.PopupAlertManager
|
||||||
import im.vector.app.features.settings.VectorPreferences
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
import im.vector.app.features.signout.hard.SignedOutActivity
|
import im.vector.app.features.signout.hard.SignedOutActivity
|
||||||
import im.vector.app.features.signout.soft.SoftLogoutActivity
|
|
||||||
import im.vector.app.features.signout.soft.SoftLogoutActivity2
|
|
||||||
import im.vector.app.features.themes.ActivityOtherThemes
|
import im.vector.app.features.themes.ActivityOtherThemes
|
||||||
import im.vector.app.features.ui.UiStateRepository
|
import im.vector.app.features.ui.UiStateRepository
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
@ -223,9 +221,11 @@ class MainActivity : VectorBaseActivity<ActivityMainBinding>(), UnlockedActivity
|
||||||
navigator.openLogin(this, null)
|
navigator.openLogin(this, null)
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
args.isSoftLogout ->
|
args.isSoftLogout -> {
|
||||||
// The homeserver has invalidated the token, with a soft logout
|
// The homeserver has invalidated the token, with a soft logout
|
||||||
getSoftLogoutActivityIntent()
|
navigator.softLogout(this)
|
||||||
|
null
|
||||||
|
}
|
||||||
args.isUserLoggedOut ->
|
args.isUserLoggedOut ->
|
||||||
// the homeserver has invalidated the token (password changed, device deleted, other security reasons)
|
// the homeserver has invalidated the token (password changed, device deleted, other security reasons)
|
||||||
SignedOutActivity.newIntent(this)
|
SignedOutActivity.newIntent(this)
|
||||||
|
@ -236,7 +236,8 @@ class MainActivity : VectorBaseActivity<ActivityMainBinding>(), UnlockedActivity
|
||||||
HomeActivity.newIntent(this)
|
HomeActivity.newIntent(this)
|
||||||
} else {
|
} else {
|
||||||
// The token is still invalid
|
// The token is still invalid
|
||||||
getSoftLogoutActivityIntent()
|
navigator.softLogout(this)
|
||||||
|
null
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
// First start, or no active session
|
// First start, or no active session
|
||||||
|
@ -247,12 +248,4 @@ class MainActivity : VectorBaseActivity<ActivityMainBinding>(), UnlockedActivity
|
||||||
intent?.let { startActivity(it) }
|
intent?.let { startActivity(it) }
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSoftLogoutActivityIntent(): Intent {
|
|
||||||
return if (resources.getBoolean(R.bool.useLoginV2)) {
|
|
||||||
SoftLogoutActivity2.newIntent(this)
|
|
||||||
} else {
|
|
||||||
SoftLogoutActivity.newIntent(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,8 @@ import im.vector.app.features.roomprofile.RoomProfileActivity
|
||||||
import im.vector.app.features.settings.VectorPreferences
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
import im.vector.app.features.settings.VectorSettingsActivity
|
import im.vector.app.features.settings.VectorSettingsActivity
|
||||||
import im.vector.app.features.share.SharedData
|
import im.vector.app.features.share.SharedData
|
||||||
|
import im.vector.app.features.signout.soft.SoftLogoutActivity
|
||||||
|
import im.vector.app.features.signout.soft.SoftLogoutActivity2
|
||||||
import im.vector.app.features.spaces.InviteRoomSpaceChooserBottomSheet
|
import im.vector.app.features.spaces.InviteRoomSpaceChooserBottomSheet
|
||||||
import im.vector.app.features.spaces.SpaceExploreActivity
|
import im.vector.app.features.spaces.SpaceExploreActivity
|
||||||
import im.vector.app.features.spaces.SpacePreviewActivity
|
import im.vector.app.features.spaces.SpacePreviewActivity
|
||||||
|
@ -115,6 +117,15 @@ class DefaultNavigator @Inject constructor(
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun softLogout(context: Context) {
|
||||||
|
val intent = if (context.resources.getBoolean(R.bool.useLoginV2)) {
|
||||||
|
SoftLogoutActivity2.newIntent(context)
|
||||||
|
} else {
|
||||||
|
SoftLogoutActivity.newIntent(context)
|
||||||
|
}
|
||||||
|
context.startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
override fun openRoom(context: Context, roomId: String, eventId: String?, buildTask: Boolean) {
|
override fun openRoom(context: Context, roomId: String, eventId: String?, buildTask: Boolean) {
|
||||||
if (sessionHolder.getSafeActiveSession()?.getRoom(roomId) == null) {
|
if (sessionHolder.getSafeActiveSession()?.getRoom(roomId) == null) {
|
||||||
fatalError("Trying to open an unknown room $roomId", vectorPreferences.failFast())
|
fatalError("Trying to open an unknown room $roomId", vectorPreferences.failFast())
|
||||||
|
|
|
@ -41,6 +41,8 @@ interface Navigator {
|
||||||
|
|
||||||
fun openLogin(context: Context, loginConfig: LoginConfig? = null, flags: Int = 0)
|
fun openLogin(context: Context, loginConfig: LoginConfig? = null, flags: Int = 0)
|
||||||
|
|
||||||
|
fun softLogout(context: Context)
|
||||||
|
|
||||||
fun openRoom(context: Context, roomId: String, eventId: String? = null, buildTask: Boolean = false)
|
fun openRoom(context: Context, roomId: String, eventId: String? = null, buildTask: Boolean = false)
|
||||||
|
|
||||||
sealed class PostSwitchSpaceAction {
|
sealed class PostSwitchSpaceAction {
|
||||||
|
|
Loading…
Reference in New Issue