Skip to content

Commit

Permalink
Merge pull request #92 from applivery/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
imablanco authored Jan 5, 2025
2 parents 6833404 + ad15106 commit d6421a3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.applivery.applvsdklib.presentation

import android.app.Activity
import androidx.appcompat.app.AlertDialog
import com.applivery.applvsdklib.AppliverySdk
import com.applivery.applvsdklib.R
import com.applivery.applvsdklib.ui.views.login.LoginView
Expand All @@ -9,6 +11,8 @@ import com.applivery.base.util.AppliveryLog

class ErrorManager {

var currentDialog: AlertDialog? = null

fun showError(failure: Failure) {
when (failure) {
is Failure.DevError -> showDevError(failure)
Expand All @@ -23,6 +27,20 @@ class ErrorManager {
AppliveryLog.error("Session Error without valid activity")
return
}
if (currentDialog?.isShowing == true) return

currentDialog = AlertDialog.Builder(activity)
.setTitle(R.string.appliveryError)
.setCancelable(false)
.setMessage(R.string.appliveryLoginRequiredText)
.setPositiveButton(R.string.appliveryLogin) { _, _ ->
currentDialog?.dismiss()
showLoginView(activity)
}
.show()
}

private fun showLoginView(activity: Activity) {
val loginView = LoginView(activity) { AppliverySdk.updateAppConfig() }
loginView.show()
}
Expand Down
1 change: 1 addition & 0 deletions applvsdklib/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,6 @@

<string name="appliveryLoginFailDielogTitle">Invalid credentials</string>
<string name="appliveryLoginFailDielogText">The email or password you entered is not valid</string>
<string name="appliveryLoginRequiredText">Please log-in before using this app</string>

</resources>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ apply from: "${rootDir}/scripts/publish-root.gradle"

ext {
PUBLISH_GROUP_ID = 'com.applivery'
PUBLISH_VERSION = '3.8.4'
PUBLISH_VERSION = '3.8.5'
}

0 comments on commit d6421a3

Please sign in to comment.