Skip to content

Commit

Permalink
upgrade to gio v7 (#55)
Browse files Browse the repository at this point in the history
masala writes:

- **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**
  • Loading branch information
leif authored Sep 20, 2024
2 parents 44477c1 + 37451b7 commit 7db6d68
Show file tree
Hide file tree
Showing 26 changed files with 651 additions and 458 deletions.
66 changes: 33 additions & 33 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build for linux
run: make docker-build-linux

- name: Upload binary artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: katzen
path: ./katzen
Expand All @@ -20,59 +20,59 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build for linux (alpine)
run: make distro=alpine docker-build-linux

- name: Upload binary artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: katzen.alpine
path: ./katzen

- name: Build for Nix
run: make docker-build-nix
#- name: Build for Nix
# run: make docker-build-nix

- name: Save output artifact name
run: ls nix_build | head -1 > nixos.output
#- name: Save output artifact name
# run: ls nix_build | head -1 > nixos.output

- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: nixos.output
path: nixos.output
#- name: Upload binary artifact
# uses: actions/upload-artifact@v4
# with:
# name: nixos.output
# path: nixos.output

build_windows:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build for windows
run: make docker-build-windows

- name: Upload binary artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: katzen.exe
path: ./katzen.exe

build_macos:
strategy:
matrix:
go-version: [1.19.x]
go-version: [1.22.x]
os: [macos-12]
runs-on: ${{ matrix.os }}

steps:
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build for MacOS (amd64)
run: CGO_CFLAGS_ALLOW="-DPARAMS=sphincs-shake-256f" CGO_ENABLED=1 GOOS="darwin" GOARCH="amd64" go build -trimpath -ldflags=-buildid= -tags dynamic -o katzen-macos-amd64
Expand All @@ -81,13 +81,13 @@ jobs:
run: CGO_CFLAGS_ALLOW="-DPARAMS=sphincs-shake-256f" CGO_ENABLED=1 GOOS="darwin" GOARCH="arm64" go build -trimpath -ldflags=-buildid= -tags dynamic -o katzen-macos-arm64

- name: Upload binary artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: katzen-macos-amd64
path: ./katzen-macos-amd64

- name: Upload binary artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: katzen-macos-arm64
path: ./katzen-macos-arm64
Expand All @@ -96,13 +96,13 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build for android
run: make KEYSTORE=reproducible.keystore KEYPASS=reproducible docker-build-android

- name: Upload binary artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: katzen.apk
path: ./katzen.apk
Expand All @@ -112,40 +112,40 @@ jobs:
needs: [build_linux, build_other_linuxes, build_windows, build_macos, build_android]
steps:
- name: Download katzen linux
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: katzen

- name: Download katzen windows
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: katzen.exe

- name: Download katzen android
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: katzen.apk

- name: Download katzen macos
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: katzen-macos-amd64

- name: Download katzen macos
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: katzen-macos-arm64

- name: Download nixos output name
uses: actions/download-artifact@v3
with:
name: nixos.output
#- name: Download nixos output name
# uses: actions/download-artifact@v4
# with:
# name: nixos.output

- name: Hash and commit
run: |
sha256sum katzen katzen.apk katzen-macos-arm64 katzen-macos-amd64 katzen.exe > katzen.sha256
echo -n "# the nixos output was: " >> katzen.sha256
cat nixos.output >> katzen.sha256
# echo -n "# the nixos output was: " >> katzen.sha256
# cat nixos.output >> katzen.sha256

- name: Create release
id: create_release
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ sign.keystore

# Nix build symlinks
result

# cache
cache/
62 changes: 38 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,27 @@ warped?=false
ldflags=-buildid= -X github.com/katzenpost/katzenpost/core/epochtime.WarpedEpoch=${warped} -X github.com/katzenpost/katzenpost/server/internal/pki.WarpedEpoch=${warped} -X github.com/katzenpost/katzenpost/minclient/pki.WarpedEpoch=${warped}
KEYSTORE := sign.keystore
KEYPASS := password
go_package_cache_dir := /tmp/katzen_go_package_cache
# gogio requires a version string ("%d.%d.%d.%d", &sv.Major, &sv.Minor, &sv.Patch, &sv.VersionCode)
# this is katzen v1 with katzenpost v0.0.35
VERSION := 1.35.0
# this is the app store application version code that must incrememnt with each official release
VERSIONCODE := 1
cache_dir=cache
# you can say, eg, 'make go_package_cache_arg= docker-shell' to not use the package cache
go_package_cache_arg := -v $(go_package_cache_dir):/go/pkg
go_package_cache_arg := -v $(shell readlink -f .)/$(cache_dir)/go:/go/ -e GOCACHE=/go/cache
docker_run_cmd=run --rm -v "$(shell readlink -f .)":/go/katzen/ $(go_package_cache_arg) --workdir /go/katzen -e CGO_CFLAGS_ALLOW="-DPARAMS=sphincs-shake-256f"

distro=debian

$(go_package_cache_dir):
mkdir -p $(go_package_cache_dir)
$(cache_dir): $(cache_dir)/go

$(cache_dir)/go:
mkdir -p $(cache_dir)/go

docker-build-linux: docker-$(distro)-base
@([ "$(distro)" = "debian" ] || [ "$(distro)" = "alpine" ]) || \
(echo "can only docker-build-linux for debian or alpine, not $(distro)" && false)
$(docker) $(docker_run_cmd) katzen/$(distro)_base bash -c 'cd /go/katzen/; go mod tidy; go build -trimpath -ldflags="${ldflags}"'
$(docker) $(docker_run_cmd) katzen/$(distro)_base go build -trimpath -ldflags="${ldflags}"

docker-build-windows: docker-debian-base
@if [ "$(distro)" != "debian" ]; then \
Expand All @@ -33,34 +40,41 @@ docker-android-base:
$(KEYSTORE):
$(docker) $(docker_run_cmd) katzen/android_sdk bash -c "keytool -genkey -keystore $(KEYSTORE) -storepass ${KEYPASS} -alias android -keyalg RSA -keysize 2048 -validity 10000 -noprompt -dname CN=android"

docker-build-android: $(go_package_cache_dir) docker-android-base $(KEYSTORE)
docker-build-android: $(cache_dir) docker-android-base $(KEYSTORE)
@if [ "$(distro)" != "debian" ]; then \
echo "can only docker-build-android on debian"; \
false; \
fi
$(docker) $(docker_run_cmd) katzen/android_sdk bash -c "cd replace-gogio && go install gioui.org/cmd/gogio && cd .. && gogio -arch arm64,amd64 -x -target android -appid chat.katzen -version 1 -signkey $(KEYSTORE) -signpass ${KEYPASS} ."
$(docker) $(docker_run_cmd) katzen/android_sdk bash -c "cd replace-gogio && go install gioui.org/cmd/gogio && cd .. && gogio -arch arm64,amd64 -x -target android -appid chat.katzen -version $(VERSION).$(VERSIONCODE) -signkey $(KEYSTORE) -signpass ${KEYPASS} ."

# this builds the debian base image, ready to have the golang deps installed
docker-debian-base: $(go_package_cache_dir)
docker-debian-base: $(cache_dir)
if ! $(docker) images|grep katzen/debian_base; then \
$(docker) run --replace --name katzen_debian_base docker.io/golang:bullseye bash -c "echo -e 'deb https://deb.debian.org/debian bullseye main\ndeb https://deb.debian.org/debian bullseye-updates main\ndeb https://deb.debian.org/debian-security bullseye-security main' > /etc/apt/sources.list && cat /etc/apt/sources.list && apt update && apt upgrade -y && apt install -y --no-install-recommends build-essential libgles2 libgles2-mesa-dev libglib2.0-dev libxkbcommon-dev libxkbcommon-x11-dev libglu1-mesa-dev libxcursor-dev libwayland-dev libx11-xcb-dev libvulkan-dev gcc-mingw-w64-x86-64" \
$(docker) run --replace --name katzen_debian_base docker.io/golang:bookworm bash -c "echo -e 'deb https://deb.debian.org/debian bookworm main\ndeb https://deb.debian.org/debian bookworm-updates main\ndeb https://deb.debian.org/debian-security bookworm-security main' > /etc/apt/sources.list && cat /etc/apt/sources.list && apt update && apt upgrade -y && apt install -y --no-install-recommends build-essential libgles2 libgles2-mesa-dev libglib2.0-dev libxkbcommon-dev libxkbcommon-x11-dev libglu1-mesa-dev libxcursor-dev libwayland-dev libx11-xcb-dev libvulkan-dev gcc-mingw-w64-x86-64" \
&& $(docker) commit katzen_debian_base katzen/debian_base \
&& $(docker) rm katzen_debian_base; \
fi

docker-nix-base: $(go_package_cache_dir)
if ! $(docker) images|grep katzen/nix_base; then \
$(docker) run --replace --name katzen_nix_base \
-v "$(shell readlink -f .)":/katzen/ --workdir /katzen \
nixos/nix:master nix \
--extra-experimental-features flakes \
--extra-experimental-features nix-command \
develop --command true \
docker-nix-base.stamp: $(cache_dir)
$(docker) run --replace --name katzen_nix_base \
-v "$(shell readlink -f .)":/katzen/ --workdir /katzen \
docker.io/nixos/nix:master nix \
--extra-experimental-features flakes \
--extra-experimental-features nix-command \
develop --command true \
&& $(docker) commit katzen_nix_base katzen/nix_base \
&& $(docker) rm katzen_nix_base; \
fi

docker-build-nix: docker-nix-base
&& $(docker) rm katzen_nix_base
touch $@

docker-nix-flake-update: docker-nix-base.stamp
$(docker) pull docker.io/nixos/nix:master
$(docker) run --rm -v "$(shell readlink -f .)":/katzen/ --workdir /katzen \
docker.io/nixos/nix:master nix \
--extra-experimental-features flakes \
--extra-experimental-features nix-command \
flake update -L

docker-build-nix: docker-nix-base.stamp
# this is for testing and updating the vendorHash (manually, after running go mod...).
# actual nix users should see README (FIXME put nix command in README)
@mkdir -p nix_build
Expand All @@ -71,7 +85,7 @@ docker-build-nix: docker-nix-base
build . -L \
&& cp -rp $$(readlink result) nix_build/'

docker-alpine-base: $(go_package_cache_dir)
docker-alpine-base: $(cache_dir)
@if ! $(docker) images|grep katzen/alpine_base; then \
$(docker) run --replace --name katzen_alpine_base docker.io/golang:alpine \
sh -c 'apk add bash gcc musl-dev libxkbcommon-dev pkgconf wayland-dev \
Expand Down Expand Up @@ -101,11 +115,11 @@ docker-android-shell: docker-android-base
$(docker) $(docker_run_cmd) --rm -it katzen/android_sdk bash

docker-clean:
-chmod -R 755 $(go_package_cache_dir) ./go_package_cache
-rm -vf result
-rm -rvf nix_build
-rm -rvf $(go_package_cache_dir)
-rm -rvf $(cache_dir)
-rm -rvf ./go_package_cache # for users of old versions of this makefile
-rm -fv *.stamp
-$(docker) rm katzen_debian_base
-$(docker) rm katzen_alpine_base
-$(docker) rm katzen_nix_base
Expand Down
12 changes: 6 additions & 6 deletions avatar.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,17 @@ func (p *AvatarPicker) Layout(gtx layout.Context) layout.Dimensions {
}

func (p *AvatarPicker) Event(gtx C) interface{} {
if p.up.Clicked() {
if p.up.Clicked(gtx) {
if u, err := filepath.Abs(filepath.Join(p.path, "..")); err == nil {
return ChooseAvatarPath{nickname: p.nickname, path: u}
}
}
if p.back.Clicked() {
if p.back.Clicked(gtx) {
return BackEvent{}
}

for _, e := range p.avatar.Events(gtx.Queue) {
if e.Type == gesture.TypeClick {
if e, ok := p.avatar.Update(gtx.Source); ok {
if e.Kind == gesture.KindClick {
ct := Contactal{}
ct.Reset()
sz := image.Point{X: gtx.Dp(96), Y: gtx.Dp(96)}
Expand All @@ -223,8 +223,8 @@ func (p *AvatarPicker) Event(gtx C) interface{} {
}

for filename, click := range p.clicks {
for _, e := range click.Events(gtx.Queue) {
if e.Type == gesture.TypeClick {
if e, ok := click.Update(gtx.Source); ok {
if e.Kind == gesture.KindClick {
// if it is a directory path - change the path
// if it is a file path, return the file selection event
if u, err := filepath.Abs(filepath.Join(p.path, filename)); err == nil {
Expand Down
Empty file added cache/go.mod
Empty file.
Loading

0 comments on commit 7db6d68

Please sign in to comment.