Improve downloads error handling
This commit is contained in:
@@ -33,6 +33,7 @@ import com.aurora.extensions.*
|
||||
import com.aurora.gplayapi.data.models.App
|
||||
import com.aurora.gplayapi.data.models.AuthData
|
||||
import com.aurora.gplayapi.data.models.File
|
||||
import com.aurora.gplayapi.exceptions.ApiException
|
||||
import com.aurora.gplayapi.helpers.AppDetailsHelper
|
||||
import com.aurora.gplayapi.helpers.PurchaseHelper
|
||||
import com.aurora.store.MainActivity
|
||||
@@ -426,9 +427,30 @@ class AppDetailsActivity : BaseDetailsActivity() {
|
||||
updateActionState(ActionButton.State.IDLE)
|
||||
}
|
||||
} failUi {
|
||||
expandBottomSheet(it.message)
|
||||
updateActionState(ActionButton.State.IDLE)
|
||||
Log.e("Failed to purchase ${app.displayName} : ${it.message}")
|
||||
var reason = "Unknown"
|
||||
|
||||
when (it) {
|
||||
is ApiException.AppNotPurchased -> {
|
||||
reason = getString(R.string.purchase_invalid)
|
||||
}
|
||||
|
||||
is ApiException.AppNotFound -> {
|
||||
reason = getString(R.string.purchase_not_found)
|
||||
}
|
||||
|
||||
is ApiException.AppNotSupported -> {
|
||||
reason = getString(R.string.purchase_unsupported)
|
||||
}
|
||||
|
||||
is ApiException.EmptyDownloads -> {
|
||||
reason = getString(R.string.purchase_no_file)
|
||||
}
|
||||
}
|
||||
|
||||
expandBottomSheet(reason)
|
||||
|
||||
Log.e("Failed to purchase ${app.displayName} : $reason")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,7 +478,7 @@ class AppDetailsActivity : BaseDetailsActivity() {
|
||||
}
|
||||
} else {
|
||||
updateActionState(ActionButton.State.IDLE)
|
||||
expandBottomSheet(getString(R.string.purchase_no_file))
|
||||
expandBottomSheet(getString(R.string.purchase_session_expired))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -306,7 +306,10 @@
|
||||
|
||||
<string name="purchase_failed">"Download Failed"</string>
|
||||
<string name="purchase_invalid">"App not purchased"</string>
|
||||
<string name="purchase_unsupported">"App not supported"</string>
|
||||
<string name="purchase_not_found">"App not found"</string>
|
||||
<string name="purchase_no_file">"Could not get files"</string>
|
||||
<string name="purchase_session_expired">"Session expired, re-login to obtain new session."</string>
|
||||
|
||||
<string name="spoof_apply">"Make sure you re-login to apply the spoof"</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user