yuriykulikov / AlarmClock

Most popular open source Android Alarm Clock App
514 stars 173 forks source link

Sending bugreport fails silently on F-Droid builds #411

Open nyxkn opened 2 years ago

nyxkn commented 2 years ago

Describe the bug

This happens in the F-Droid build, or when building locally. When pressing "OK" in the "Send a bugreport" dialog, nothing happens.

Why this happens

From a little testing, this seems to be because sendUserReport() needs ACRA_EMAIL to be set to proceed. ACRA_EMAIL isn't set in F-Droid builds because this property gets set from reading local.properties.

Thoughts

The report sending button failing silently is puzzling for the user (as it was for me).

Is it intentional for the bug report feature not to be enabled in F-Droid builds? In that case, it would be good to have a written warning somewhere, or even disable the bugreport menu entry entirely.

yuriykulikov commented 2 years ago

Hello @nyxkn,

The issue is pretty easy to fix, but I think I need some help with FDroid. Do you have any experience configuring it?

nyxkn commented 2 years ago

Hey! This happens because you're reading acra.email from the local.properties file. This file isn't (and correctly shouldn't) be included in the git repo. But this way f-droid has no way of knowing what this value is, because f-droid makes a clean build from your git repo and can only be aware of what's included in git.

So the solution would be to have acraemail set somewhere that's included in the git repo.

I see that you're setting acraEmail in app/build.gradle.kts, by reading from the local.properties file. Then you could read this value from a different file instead (e.g. acra.properties) that you do add to git. Or even hardcode the email value in build.gradle.kts if that works for you.

In any case, this value just needs to exist somewhere in the git repo for f-droid to pick it up.

yuriykulikov commented 2 years ago

@nyxkn please take a look at how it is done in my github actions config: https://github.com/yuriykulikov/AlarmClock/blob/ed8c21f4d6c76a6cfb27ba61f100e453ef0f00be/.github/workflows/gradle.yml#L13

I thought that something like this should also be possible on F-droid.

I don't want to check in my email in git. I have had this before and I was getting hundreds of emails every week from countless forks, many of which were not stable.

nyxkn commented 2 years ago

Ah, you make a good point about the forks that I hadn't thought about!

It should be possible to add the email address in the prebuild section of the fdroid build metadata file (https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/com.better.alarm.yml), where you can add custom commands that run before the build; maybe either setting the email as an environment variable or creating the secrets file. https://f-droid.org/en/docs/Build_Metadata_Reference/#build_prebuild

This way the email would only appear in the fdroid metadata file and not in the git repo, avoiding the forking issue. At the moment I'm not aware of other ways of tackling this.