F43nd1r / Acrarium

A Backend for ACRA written in Kotlin using Spring Boot, Vaadin and MySQL
Apache License 2.0
199 stars 51 forks source link

Acrarium showing ACRA version by default on reports tab, not app version #389

Closed mikehardy closed 1 year ago

mikehardy commented 1 year ago

Hey @F43nd1r :wave: - I think this line here is causing me problems, and I'm curious for your opinion:

https://github.com/F43nd1r/Acrarium/blob/9c6f1283df309d8566593e9b6ed8354e576bba09/acrarium/src/main/kotlin/com/faendir/acra/service/DataService.kt#L348

What I see then is "5.7.0" (current ACRA version sending this report) on Acrarium on my bugs / reports tabs for the app,

Screenshot from 2022-10-10 17-20-12

I think it is because this is in the report, leading to the line of code above:

APP_VERSION_NAME 2.15.6

... (much later) ...

BUILD_CONFIG  BUILD_TYPE release
                            DEBUG false
                            LIBRARY_PACKAGE_NAME org.acra.dialog
                            VERSION_CODE -1
                            VERSION_NAME 5.7.0

I suppose that is because it's the :acra process sending the report?

Would it be okay to reverse those first two in the optional value chain, like so?

        val versionName: String = buildConfig?.findString("APP_VERSION_NAME") ?: jsonObject.findString(ReportField.VERSION_NAME.name) ?: "N/A"
F43nd1r commented 1 year ago

For the issue itself, please make sure this is not a duplicate of https://github.com/F43nd1r/Acrarium/issues/319. Regarding switching those two statements: that would be possible, but the current order was chosen because buildconfig values are either always or never available, whereas appVersionName relies on package manager being available after the app crashed, which is most of the time but not always the case.

mikehardy commented 1 year ago

Ahhh - you are right, I'm sorry I did not see that duplicate. I not only have the exact same issue as the one you linked - and for the same reason - but just sharing this for a smile - it is not even so subtle.

I am explicitly fully specifying the wrong class. 🤦

            .withBuildConfigClass(org.acra.dialog.BuildConfig::class.java)

Thanks