implemented donwload upload handling with username
This commit is contained in:
@ -434,17 +434,25 @@ class HandlerOpeningScreen(private val activity: MainActivity) {
|
||||
private fun setupUploadButton() {
|
||||
uploadButton.text = t("upload")
|
||||
uploadButton.setOnClickListener {
|
||||
// Token aus dem Login (MainActivity speichert es in TokenStore)
|
||||
val token = TokenStore.getToken(activity)
|
||||
if (token.isNullOrBlank()) {
|
||||
Toast.makeText(
|
||||
activity,
|
||||
t("login_required") ?: "Bitte zuerst einloggen",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
// wie gewohnt: Client-Code merken, dann direkt hochladen
|
||||
GlobalValues.LAST_CLIENT_CODE = editText.text.toString().trim()
|
||||
promptCredentials(
|
||||
title = t("login_required") ?: "Login erforderlich",
|
||||
onOk = { user, pass ->
|
||||
// Login -> Upload
|
||||
DatabaseUploader.uploadDatabaseWithLogin(activity, user, pass)
|
||||
}
|
||||
)
|
||||
DatabaseUploader.uploadDatabaseWithToken(activity, token)
|
||||
// Hinweis: Nach erfolgreichem Upload schließt sich die App (exitProcess(0)) wie bisher.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun setupDownloadButton() {
|
||||
downloadButton.text = t("download")
|
||||
downloadButton.setOnClickListener {
|
||||
|
||||
Reference in New Issue
Block a user