Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 213155bb authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Merge branch '2837-u-improve-error-management' into 'main'

Improve app details loading

See merge request !528
parents 03f50a51 9f5ed56a
Loading
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -46,8 +46,6 @@ suspend fun <T> handleNetworkResult(call: suspend () -> T): ResultSupreme<T> {
        handleSocketTimeoutException(e)
    } catch (e: GplayHttpRequestException) {
        resultSupremeGplayHttpRequestException(e)
    } catch (e: IllegalStateException) {
        throw e
    } catch (e: Exception) {
        handleOthersException(e)
    }
+13 −6
Original line number Diff line number Diff line
@@ -137,16 +137,23 @@ class ApplicationViewModel @Inject constructor(
                        packageName,
                        origin
                    )
                result.first.isPurchased = isPurchased

                val app = result.first
                val status = result.second

                app.isPurchased = isPurchased
                applicationLiveData.postValue(result)

                updateShareVisibilityState(result.first.shareUri.toString())
                updateAppContentRatingState(packageName, result.first.contentRating)
                updateShareVisibilityState(app.shareUri.toString())
                updateAppContentRatingState(packageName, app.contentRating)

                if (status != ResultStatus.OK) {
                    EventBus.invokeEvent(
                        AppEvent.InvalidAuthEvent(AuthObject.GPlayAuth::class.java.simpleName)
                    )
                }
            } catch (e: InternalException.AppNotFound) {
                _errorMessageLiveData.postValue(R.string.app_not_found)
            } catch (exception: IllegalStateException) {
                exception.printStackTrace()
                EventBus.invokeEvent(AppEvent.InvalidAuthEvent(AuthObject.GPlayAuth::class.java.simpleName))
            } catch (e: Exception) {
                _errorMessageLiveData.postValue(R.string.unknown_error)
            }