forked from GitHub-Mirror/riotX-android
Move signout action to the settings General
This commit is contained in:
parent
4422ebb77b
commit
40bf3a15cd
@ -29,4 +29,8 @@ fun Session.configureAndStart(pushRuleTriggerListener: PushRuleTriggerListener)
|
||||
refreshPushers()
|
||||
pushRuleTriggerListener.startWithSession(this)
|
||||
fetchPushRules()
|
||||
|
||||
// TODO P1 From HomeActivity
|
||||
// @Inject lateinit var incomingVerificationRequestHandler: IncomingVerificationRequestHandler
|
||||
// @Inject lateinit var keyRequestHandler: KeyRequestHandler
|
||||
}
|
@ -29,7 +29,6 @@ import androidx.fragment.app.FragmentManager
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import com.airbnb.mvrx.viewModel
|
||||
import im.vector.matrix.android.api.Matrix
|
||||
import im.vector.riotredesign.R
|
||||
import im.vector.riotredesign.core.di.ActiveSessionHolder
|
||||
import im.vector.riotredesign.core.di.ScreenComponent
|
||||
@ -44,9 +43,7 @@ import im.vector.riotredesign.features.crypto.keysrequest.KeyRequestHandler
|
||||
import im.vector.riotredesign.features.crypto.verification.IncomingVerificationRequestHandler
|
||||
import im.vector.riotredesign.features.disclaimer.showDisclaimerDialog
|
||||
import im.vector.riotredesign.features.notifications.NotificationDrawerManager
|
||||
import im.vector.riotredesign.features.rageshake.BugReporter
|
||||
import im.vector.riotredesign.features.rageshake.VectorUncaughtExceptionHandler
|
||||
import im.vector.riotredesign.features.workers.signout.SignOutUiWorker
|
||||
import im.vector.riotredesign.features.workers.signout.SignOutViewModel
|
||||
import im.vector.riotredesign.push.fcm.FcmHelper
|
||||
import kotlinx.android.synthetic.main.activity_home.*
|
||||
@ -168,10 +165,12 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.sliding_menu_sign_out -> {
|
||||
SignOutUiWorker(this, notificationDrawerManager).perform(activeSessionHolder.getActiveSession())
|
||||
return true
|
||||
}
|
||||
// TODO Remove
|
||||
// R.id.sliding_menu_sign_out -> {
|
||||
// SignOutUiWorker(this, notificationDrawerManager)
|
||||
// .perform(Matrix.getInstance().currentSession!!)
|
||||
// return true
|
||||
// }
|
||||
}
|
||||
|
||||
return true
|
||||
|
@ -34,7 +34,9 @@ import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceCategory
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import im.vector.matrix.android.api.Matrix
|
||||
import im.vector.riotredesign.R
|
||||
import im.vector.riotredesign.core.di.ActiveSessionHolder
|
||||
import im.vector.riotredesign.core.extensions.showPassword
|
||||
import im.vector.riotredesign.core.platform.SimpleTextWatcher
|
||||
import im.vector.riotredesign.core.preference.UserAvatarPreference
|
||||
@ -44,15 +46,21 @@ import im.vector.riotredesign.core.utils.allGranted
|
||||
import im.vector.riotredesign.core.utils.copyToClipboard
|
||||
import im.vector.riotredesign.core.utils.toast
|
||||
import im.vector.riotredesign.features.MainActivity
|
||||
import im.vector.riotredesign.features.notifications.NotificationDrawerManager
|
||||
import im.vector.riotredesign.features.themes.ThemeUtils
|
||||
import im.vector.riotredesign.features.workers.signout.SignOutUiWorker
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
||||
class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
|
||||
|
||||
override var titleRes = R.string.settings_general_title
|
||||
override val preferenceXmlRes = R.xml.vector_settings_general
|
||||
|
||||
@Inject lateinit var activeSessionHolder: ActiveSessionHolder
|
||||
@Inject lateinit var notificationDrawerManager: NotificationDrawerManager
|
||||
|
||||
private var mDisplayedEmails = ArrayList<String>()
|
||||
private var mDisplayedPhoneNumber = ArrayList<String>()
|
||||
|
||||
@ -227,6 +235,18 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
// Sign out
|
||||
findPreference("SETTINGS_SIGN_OUT_KEY")
|
||||
.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
activity?.let {
|
||||
SignOutUiWorker(requireActivity(), notificationDrawerManager)
|
||||
.perform(activeSessionHolder.getActiveSession())
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
|
||||
// Deactivate account section
|
||||
|
||||
// deactivate account
|
||||
|
@ -17,13 +17,13 @@
|
||||
package im.vector.riotredesign.features.workers.signout
|
||||
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import im.vector.matrix.android.api.session.Session
|
||||
import im.vector.riotredesign.R
|
||||
import im.vector.riotredesign.core.platform.VectorBaseActivity
|
||||
import im.vector.riotredesign.features.MainActivity
|
||||
import im.vector.riotredesign.features.notifications.NotificationDrawerManager
|
||||
|
||||
class SignOutUiWorker(private val activity: VectorBaseActivity,
|
||||
class SignOutUiWorker(private val activity: FragmentActivity,
|
||||
private val notificationDrawerManager: NotificationDrawerManager) {
|
||||
|
||||
fun perform(session: Session) {
|
||||
|
@ -93,6 +93,15 @@
|
||||
|
||||
<im.vector.riotredesign.core.preference.VectorPreferenceDivider />
|
||||
|
||||
<im.vector.riotredesign.core.preference.VectorPreferenceCategory
|
||||
android:title="@string/action_sign_out">
|
||||
|
||||
<im.vector.riotredesign.core.preference.VectorPreference
|
||||
android:key="SETTINGS_SIGN_OUT_KEY"
|
||||
android:title="@string/action_sign_out" />
|
||||
|
||||
</im.vector.riotredesign.core.preference.VectorPreferenceCategory>
|
||||
|
||||
<im.vector.riotredesign.core.preference.VectorPreferenceCategory
|
||||
android:key="SETTINGS_DEACTIVATE_ACCOUNT_CATEGORY_KEY"
|
||||
android:title="@string/settings_deactivate_account_section">
|
||||
|
Loading…
Reference in New Issue
Block a user