diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-15 01:32:56 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-15 01:32:56 -0600 |
commit | a646440e5384c5adb9914211666fcc776cf87567 (patch) | |
tree | 2d21f7a4a2da7fc168ba71cf6818952e9336ebd5 /androidApp/src | |
parent | a48d8624d2ee876eac1fed2d0c32af7dccb4a195 (diff) | |
download | etbsa-trackermap-mobile-a646440e5384c5adb9914211666fcc776cf87567.tar.gz etbsa-trackermap-mobile-a646440e5384c5adb9914211666fcc776cf87567.tar.bz2 etbsa-trackermap-mobile-a646440e5384c5adb9914211666fcc776cf87567.zip |
FCM token unregisters when logging out
Diffstat (limited to 'androidApp/src')
2 files changed, 8 insertions, 6 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationActivity.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationActivity.kt index f384173..5ae8c75 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationActivity.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationActivity.kt @@ -7,12 +7,11 @@ import android.os.Bundle import android.view.View import android.widget.Toast import androidx.appcompat.app.AppCompatActivity +import androidx.preference.PreferenceManager import com.zhuinden.liveevent.observe import kotlinx.coroutines.DelicateCoroutinesApi import mx.trackermap.TrackerMap.android.R import mx.trackermap.TrackerMap.android.databinding.UserInformationActivityBinding -import mx.trackermap.TrackerMap.client.models.User -import mx.trackermap.TrackerMap.controllers.ReportController import mx.trackermap.TrackerMap.controllers.SessionController import org.koin.androidx.viewmodel.ext.android.viewModel @@ -71,7 +70,11 @@ class UserInformationActivity : AppCompatActivity() { private fun setupEvents() { binding.backButton.setOnClickListener { onBackPressed() } - binding.signoutButton.setOnClickListener { userInformationViewModel.signOut() } + binding.signoutButton.setOnClickListener { + userInformationViewModel.signOut(PreferenceManager + .getDefaultSharedPreferences(this) + .getString(LoginFragment.PREFERENCE_TOKEN, null)) + } binding.sourceCodeButton.setOnClickListener { openURL(getString(R.string.app_source_code_url)) } diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationViewModel.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationViewModel.kt index 607f4e5..9bb5ac7 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationViewModel.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationViewModel.kt @@ -10,7 +10,6 @@ import com.zhuinden.eventemitter.EventSource import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch -import mx.trackermap.TrackerMap.client.apis.SessionApi import mx.trackermap.TrackerMap.client.models.User import mx.trackermap.TrackerMap.controllers.SessionController import org.koin.core.component.KoinComponent @@ -68,9 +67,9 @@ class UserInformationViewModel : ViewModel(), KoinComponent { } } - fun signOut() { + fun signOut(token: String?) { viewModelScope.launch { - sessionController.logout() + sessionController.logout(token) } } }
\ No newline at end of file |