fix bug in seat selector + more android stuff

This commit is contained in:
2023-10-09 17:49:45 +02:00
parent ee5b70fd3c
commit 45562414e4
5 changed files with 30 additions and 23 deletions

View File

@@ -18,7 +18,7 @@ class MainActivity : AppCompatActivity() {
val policy = ThreadPolicy.Builder().permitAll().build()
StrictMode.setThreadPolicy(policy)
val sharedPref = getPreferences( MODE_PRIVATE )
val sharedPref = getSharedPreferences( "login", MODE_PRIVATE )
val hasSwitched = intent.hasExtra("hasSwitched")
@@ -50,7 +50,7 @@ class MainActivity : AppCompatActivity() {
val res = ApiClient().authenticateUser( url, username, password )
println( res )
if ( res == "authOk" ) {
val sharedPref = getPreferences( MODE_PRIVATE )
val sharedPref = getSharedPreferences( "login", MODE_PRIVATE )
val editor = sharedPref.edit()
editor.putString( "username", username )
editor.putString( "password", password )

View File

@@ -4,7 +4,6 @@ import android.Manifest
import android.app.AlertDialog
import android.content.Intent
import android.content.pm.PackageManager
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import androidx.core.app.ActivityCompat
@@ -28,7 +27,7 @@ class ScannerActivity : CaptureActivity() {
val logoutButton = findViewById<Button>(R.id.logoutButton)
logoutButton.setOnClickListener {
val sharedPref = getPreferences( MODE_PRIVATE )
val sharedPref = getSharedPreferences( "login", MODE_PRIVATE )
val editor = sharedPref.edit()
editor.remove( "loginOk" )
editor.remove( "username" )
@@ -64,8 +63,7 @@ class ScannerActivity : CaptureActivity() {
private fun handleScanResult(result: String) {
if ( lastScanned != result ) {
println(result)
val sharedPref = getPreferences( MODE_PRIVATE )
val sharedPref = getSharedPreferences( "login", MODE_PRIVATE )
ApiClient().checkTicket( sharedPref.getString( "url", null ).toString(),
sharedPref.getString( "username", null ).toString(),