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

[GH-314] Persist user settings in native Linux app #1018

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Johennes
Copy link
Contributor

Summary

This PR adds persistence for the user settings in the native Linux app. The settings are written to $XDG_CONFIG_HOME/focalboard/settings. If XDG_CONFIG_HOME is unset, the app falls back to $HOME/.config.

The change hooks into the existing settings export already used in the native macOS app which means the settings are persisted immediately on change.

Unfortunately, the golang webview package uses a custom native binding technology and doesn't allow to define WebKit message handlers. As a result, a dedicated message handler function was added to the existing NativeApp object. In the native macOS app, said handler is short-circuited to window.webkit.messagehandlers.[NAME].postMessage. This has the benefit that the web app remains agnostic of the particular native binding mechanism.

I have virtually zero experience with Go so while this appears to be working in my testing, the code very likely is an abomination. I'm looking forward to candid feedback. 🙂

I'd also appreciate some more testing. When running the Linux app on a mac, I once got a blank screen on launch but didn't manage to reproduce again. When testing on Linux, I didn't observe any issues so far.

Ticket Link

Relates to #314.

@Johennes Johennes requested a review from a team as a code owner August 17, 2021 13:25
@Johennes Johennes requested review from sbishel and chenilim and removed request for a team August 17, 2021 13:25
@mattermod
Copy link
Contributor

Hello @Johennes,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@sbishel sbishel requested review from jespino and removed request for sbishel August 19, 2021 13:28
@mattermod
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

@chenilim chenilim removed their request for review September 24, 2021 23:41
@chenilim
Copy link
Contributor

Cleaning up stale issues. Sorry for the delay! @jespino, could you help review this one for the Linux app? Thanks.

@Johennes
Copy link
Contributor Author

Johennes commented Oct 9, 2021

Rebased on latest main and did a short re-test. 🙂

This commit adds persistence for the user settings in the native Linux
app. The settings are written to $XDG_CONFIG_HOME/focalboard/settings.
If XDG_CONFIG_HOME is unset, the app falls back to $HOME/.config.

The change hooks into the existing settings export already used in the
nativve macOS app which means the settings are persisted immediately on
change.

Unfortunately, the golang webview package uses a custom native binding
technology and doesn't allow to define WebKit message handlers. As a
result, a dedicated message handler function was added to the existing
NativeApp object. In the native macOS app, said handler is
short-circuited to window.webkit.messagehandlers.[NAME].postMessage.
This has the benefit that the web app remains agnostic of the particular
native binding mechanism.

Relates to: mattermost-community#314
@Johennes Johennes force-pushed the feature/persist-linux-settings branch from b3ab554 to a2fa259 Compare October 9, 2021 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants