flatpak: Ignore FLATPAK_ERROR_ALREADY_INSTALLED when installing apps

Somehow, sometimes, it might be possible for the state in gnome-software
to be out of date, and hence for g-s to start installing an app which is
actually already installed.

If that happens for an app, libflatpak will return
`flatpak_transaction_add_install()`. If it happens for a flatpakref or a
bundle, libflatpak will return the error from
`flatpak_transaction_run()` instead (since it needs to resolve the
flatpakrefs and bundles to refs before it can determine whether they’re
already installed).

Handle both of those cases in the flatpak plugin, marking the app as
installed if libflatpak returns that error code. The handling of it is
not especially pretty, since it needs to still fall through and refresh
the `GsApp` after marking it as installed.

Based on a downstream commit by Joaquim Rocha <jrocha@endlessm.com>.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
1 job for flatpak-already-installed in 24 minutes and 16 seconds (queued for 1 second)
Status Job ID Name Coverage
passed #344334