Show banner alerting users to how google developer verification threatens F-Droid.

Sibling MR of the website version here: fdroid-website!1467 (merged)

We discussed as a team at FOSDEM our desire to start showing the issue to more people via banners on website + client.

In this change:

  • Banner is only shown on the Latest tab (we could show it on all other tabs, but this is easier and figured it gets the message across).
  • Only shown until the end of March (so that users of this build are not stuck with a banner for the next 10 years).
  • Dismissing it will remember via shared preferences and now show again.
  • Tapping banner will launch browser to https://keepandroidopen.org

image

Plays nicely with the "Updating repositories" and "No internet" banner:

image image

Chose a single colour for both themes, for both simplicity, but also because I think it still fits nice enough:

image

Requesting feedback

A little out of practice, so feedback on the implementation is welcome:

Expiry date

Regarding the "only until end of March". I am happy to change this to a different time, but I would still like to time-bound it. If for some reason a user finds this version in 2 years time, I'd hope that this is all resolved and there is no need for this version to continue to nag people forever into the future.

Preview + FDroidContent

I am also still learning Compose, so I've copied the way in which the repo chooser does Compose-from-within-Java. However, I'm obviously open to feedback on the implementation. One thing I don't understand is why when my @Preview function wraps the call in FDroidContent then it fails to render with this issue:

java.lang.RuntimeException: Attempted to access preferences before it has been initialized in FDroidApp
  at org.fdroid.fdroid.Preferences.get(Preferences.java:922)
  at org.fdroid.fdroid.ui.theme.ThemeKt.FDroidContent(Theme.kt:97)

This happened even before I even used shared preferences, and even if I just, e.g. render a text view.

Compose architecture

I wanted to be able to @Preview the banner, so I made a dumb component that is just presentation. Then I wrapped it in a stateful component which manages sideeffects (relating to expiry date and the shared preferences as to whether it is dismissed).

Is this an okay design? Or should I just push the state down into the main component here because it is all pretty small?

Test cases

I only have one simple test to check if the "has expired" function works, but no UI tests. Should I add UI tests? If so, to what level?

Merge request reports

Loading