From 8450a24a914919a0b77c7ba6b85718aecc6bd90a Mon Sep 17 00:00:00 2001 From: sim Date: Sun, 19 Mar 2023 17:44:15 +0100 Subject: [PATCH] Inform when the login fails --- .../distributor/nextpush/account/DirectAccountFactory.kt | 4 +++- .../distributor/nextpush/activities/StartActivity.kt | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/unifiedpush/distributor/nextpush/account/DirectAccountFactory.kt b/app/src/main/java/org/unifiedpush/distributor/nextpush/account/DirectAccountFactory.kt index eafb0be..aa60429 100644 --- a/app/src/main/java/org/unifiedpush/distributor/nextpush/account/DirectAccountFactory.kt +++ b/app/src/main/java/org/unifiedpush/distributor/nextpush/account/DirectAccountFactory.kt @@ -91,7 +91,9 @@ class DirectAccountFactory : AccountFactory { } private fun retActivity(activity: Activity) { - (activity as StartActivity).onActivityResult(0, 0, null) + activity.runOnUiThread { + (activity as StartActivity).onActivityResult(0, 0, null) + } } inner class DirectAuth(private val username: String, private val password: String) : Authenticator { diff --git a/app/src/main/java/org/unifiedpush/distributor/nextpush/activities/StartActivity.kt b/app/src/main/java/org/unifiedpush/distributor/nextpush/activities/StartActivity.kt index 7faff5b..e6d5d0a 100644 --- a/app/src/main/java/org/unifiedpush/distributor/nextpush/activities/StartActivity.kt +++ b/app/src/main/java/org/unifiedpush/distributor/nextpush/activities/StartActivity.kt @@ -11,6 +11,7 @@ import android.widget.EditText import android.widget.ImageView import android.widget.RelativeLayout import android.widget.TextView +import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import androidx.core.view.isGone import com.google.android.material.textfield.TextInputEditText @@ -74,6 +75,8 @@ class StartActivity : AppCompatActivity() { if (success) { goToMainActivity(this) finish() + } else { + Toast.makeText(applicationContext, "Could not connect to UnifiedPush provider", Toast.LENGTH_SHORT).show() } } }