aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'androidApp/src/main')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationActivity.kt9
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/session/UserInformationViewModel.kt5
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