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

Commit 9f5ed56a authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Always post value for LiveData

Even when app version code equals 0.
parent 03f50a51
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)
            }