Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to gio v7 #55

Merged
merged 44 commits into from
Sep 20, 2024
Merged

upgrade to gio v7 #55

merged 44 commits into from
Sep 20, 2024

Conversation

mixmasala
Copy link
Contributor

  • update pinned gio based off of v0.7.0, with foreground service
  • Adds new configuration fields to the baked-in configuration profiles that specify the algorithms used.
  • go fmt...
  • remove CGO_CFLAGS_ALLOW
  • upgrade build image to debian bookworm
  • signin: update gio API usage
  • avatar: update gio API
  • contact: update gio API usage
  • update gio API usage
  • update gio clipboard API usage
  • add contact: make username entry default focus
  • conversation: update gio API usage
  • gesture: update gio API usage
  • editcontact: update gio API usage of widget.Slider
  • make debug flag (-d) accept a port # as argument
  • update gio API usage
  • update gio API (Clickable)
  • update gio API - window does not provide a channel, so wrap it to multiplex event sources
  • key.Set is deprecated
  • WIP: add helper to receive shortcut key events
  • WIP: fix some stack bug
  • refactor shortcut keypress detection
  • do not capture click/release as 2 events
  • move catshadow.Contact sort.Interface into sort.go
  • cache contacts from catshadow.GetContacts and update on AddContactComplete
  • home: fix keyboard controls
  • Makefile: omit subshell
  • WIP: refactor contactlist selection
  • build libhighctidh without portable mode
  • Use GOCACHE and docker/cache
  • cache: add empty go.mod and .gitignore
  • edit contact: debounce click event
  • rename contact: set focus to editor
  • WIP: simplify, get rid of focus bool
  • redraw screen when contacts are updated
  • start foreground at app init
  • update replace-gogio
  • update Makefile, gogio requires different version string now
  • add handler for android platform specific AndroidViewEvent

note that TargetFilter must have both Target and Type for it to match.
slider now works over a range of 0.0-1.0
system.StageEvent is deprecated and system.FrameEvent is moved to app.FrameEvent.

This means we need to keep track of whether we're getting FrameEvents to learn whether the application has focus on Android, in order to start a Foreground service.
There might be other event types that we can monitor to learn this. TBD.
found this in my git stash. I think this fixes a bug.
make backbutton / escape detection global, and handle key release detection (and not for android which doesn't support key.Release
This fixes broken foreground service handling on android.
The previous behavior with android was broken because when swiped off tray and re-launched, the application was still running and had not exited properly.

On this branch, this fixes this behavior so that when katzen is launched the notification appears, and when the view is swiped off tray, immediately stops.

The issue was that in gio, when an app.DestroyEvent is received, while a foreground service is running, it is too late to stop the foreground service before
android has decided it shouldn't stop the main activity after all.

The workaround is that in gio, when an android view onDestroy is received by GioView, gio sends an AndroidViewEvent.View = 0
when this occurs, we should stop reading Events, and halt the foreground service, otherwise
the foreground service is still running and android does not halt the main activity at onDestroy.

If this isn't done, immediately re-launching the application tries to open a new view with the existing activity,
which causes a ANR as the view does not receive input. Otherwise, the ANR eventually kills the process and re-launching works again.

I tested this and confirmed that on android-31:
I can start/stop katzen, the foreground service notification is displayed, and when the view is swiped off tray, immediately is removed.
re-starting katzen presents the login screen as expected.
I tested that make docker-build-nix works locally, but it fails in
the github-ci environment with permission errors:
```
build_other_linuxes	Build for Nix	2024-09-20T07:36:33.6471719Z building '/nix/store/25ijc05ya70h07i9569jm8r61j49bqw9-katzen-unstable-20240920073414-go-modules.drv'...
build_other_linuxes	Build for Nix	2024-09-20T07:36:33.9374960Z error: builder for '/nix/store/25ijc05ya70h07i9569jm8r61j49bqw9-katzen-unstable-20240920073414-go-modules.drv' failed with exit code 1;
build_other_linuxes	Build for Nix	2024-09-20T07:36:33.9376414Z        last 4 log lines:
build_other_linuxes	Build for Nix	2024-09-20T07:36:33.9377148Z        > Running phase: unpackPhase
build_other_linuxes	Build for Nix	2024-09-20T07:36:33.9378227Z        > unpacking source archive /nix/store/c30a1mz53jx5mbp2m5rk93745i2pv62h-source
build_other_linuxes	Build for Nix	2024-09-20T07:36:33.9379423Z        > cp: setting permissions for 'source': Operation not permitted
build_other_linuxes	Build for Nix	2024-09-20T07:36:33.9380851Z        > do not know how to unpack source archive /nix/store/c30a1mz53jx5mbp2m5rk93745i2pv62h-source
build_other_linuxes	Build for Nix	2024-09-20T07:36:33.9382876Z        For full logs, run 'nix log /nix/store/25ijc05ya70h07i9569jm8r61j49bqw9-katzen-unstable-20240920073414-go-modules.drv'.
build_other_linuxes	Build for Nix	2024-09-20T07:36:34.0858793Z error: 1 dependencies of derivation '/nix/store/89gffkm0fljnwal2f478bq6ma9m7fqal-katzen-unstable-20240920073414-env.drv' failed to build
build_other_linuxes	Build for Nix	2024-09-20T07:36:36.2549473Z make: *** [Makefile:59: docker-nix-base.stamp] Error 1
build_other_linuxes	Build for Nix	2024-09-20T07:36:36.2566840Z ##[error]Process completed with exit code 2.

```

this commit disables github-ci for nixos because I don't have any more time to debug this.