Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Flatpak support #346

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@ app.*.map.json

# Xcode build files
ios/build

# Flatpak build files
flatpak/.flatpak-builder
flatpak/build-dir
flatpak/lemmur-linux-*.tar.gz
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ A mobile client for [Lemmy](https://github.com/LemmyNet/lemmy) - a federated red
- [Linux](#linux)
- [Windows](#windows)
- [FAQ](#faq)
- [Version x.x.x was released, why is it not yet on F-droid?](#version-xxx-was-released-why-is-it-not-yet-on-f-droid)
- [Version x.x.x was released, why is it not yet on F-droid/Flatpak?](#version-xxx-was-released-why-is-it-not-yet-on-f-droidflatpak)
- ["App not installed" - what to do?](#app-not-installed---what-to-do)

## Build from source
Expand Down Expand Up @@ -57,7 +57,7 @@ The executable will be in `build\windows\runner\Release\lemmur.exe` (be aware, h

## FAQ

### Version x.x.x was released, why is it not yet on F-droid?
### Version x.x.x was released, why is it not yet on F-droid/Flatpak?

We have no control over F-droid's build process. This process is automatic and not always predictable in terms of time it takes. If a new version does not appear in F-droid a week after its release, then feel free to open an issue about it and we will look into it.

Expand Down
24 changes: 24 additions & 0 deletions flatpak/app_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions flatpak/com.krawieck.lemmur.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Desktop Entry]
Version=1.0
Type=Application

Name=Lemmur
Comment=A client for lemmy - a federated reddit alternative
Categories=Network;News;X-Social Media;

Icon=com.krawieck.lemmur
Exec=lemmur
Terminal=false
StartupWMClass=lemmur
68 changes: 68 additions & 0 deletions flatpak/com.krawieck.lemmur.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"app-id": "com.krawieck.lemmur",
"runtime": "org.freedesktop.Platform",
"runtime-version": "22.08",
"sdk": "org.freedesktop.Sdk",
"command": "lemmur",
"separate-locales": false,
"finish-args": [
"--share=ipc",
"--socket=fallback-x11",
"--socket=wayland",
"--device=dri",
"--socket=pulseaudio",
"--share=network",
"--filesystem=xdg-download"
],
"modules": [
{
"name": "lemmur",
"buildsystem": "simple",
"only-arches": [
"x86_64"
],
"build-commands": [
"ls lemmur",
"cp -r lemmur /app/lemmur",
"chmod +x /app/lemmur/lemmur",
"mkdir -p /app/bin",
"install -Dm644 ./app_icon.svg /app/share/icons/hicolor/scalable/apps/com.krawieck.lemmur.svg",
"ln -s /app/lemmur/lemmur /app/bin/lemmur",
"install -Dm644 com.krawieck.lemmur.desktop /app/share/applications/com.krawieck.lemmur.desktop",
"install -Dm644 com.krawieck.lemmur.metainfo.xml /app/share/appdata/com.krawieck.lemmur.metainfo.xml"
],
"sources": [
{
"type": "file",
"path": "com.krawieck.lemmur.metainfo.xml"
},
{
"type": "file",
"path": "com.krawieck.lemmur.desktop"
},
{
"type": "file",
"path": "app_icon.svg"
},
{
"type": "archive",
"only-arches": [
"x86_64"
],
"url": "https://github.com/LemmurOrg/lemmur/releases/download/v0.8.0/lemmur-v0.8.0-x86_64-linux.tar.gz",
"dest": "lemmur",
"sha256": "47bbd7cc7ad2c4f036cd26ba552d2a17c786f0e834d214bf4cb1ab2395ec2079",
"strip-components": 0,
"x-checker-data": {
"type": "json",
"url": "https://api.github.com/repos/lemmurorg/lemmur/releases/latest",
"version-query": ".tag_name",
"url-query":".assets[] | select(.name==\"lemmur-\" + $version + \"-x86_64-linux.tar.gz\") | .browser_download_url"
}
}


]
}
]
}
50 changes: 50 additions & 0 deletions flatpak/com.krawieck.lemmur.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>com.krawieck.lemmur</id>

<name>Lemmur</name>
<summary>A client for lemmy - a federated reddit alternative</summary>

<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0-only</project_license>

<supports>
<control>pointing</control>
<control>keyboard</control>
<control>touch</control>
</supports>

<developer_name>Filip Krawczyk</developer_name>
<url type="homepage">https://github.com/LemmurOrg/lemmur</url>
<url type="bugtracker">https://github.com/LemmurOrg/lemmur/issues</url>
<url type="donation">https://www.buymeacoffee.com/lemmur</url>
<url type="translate">https://weblate.join-lemmy.org/engage/lemmur</url>

<description>
<p>
Lemmur aims to provide a seamless experience when browsing different Lemmy instances.
</p>
<p>
You can have multiple multiple instances added at the same time without having to awkwardly switch between them.
</p>
</description>

<screenshots>
<screenshot>
<image type="source">https://f-droid.org/repo/com.krawieck.lemmur/en-US/phoneScreenshots/1.png</image>
<image type="source">https://f-droid.org/repo/com.krawieck.lemmur/en-US/phoneScreenshots/2.png</image>
<image type="source">https://f-droid.org/repo/com.krawieck.lemmur/en-US/phoneScreenshots/3.png</image>
<image type="source">https://f-droid.org/repo/com.krawieck.lemmur/en-US/phoneScreenshots/4.png</image>
<image type="source">https://f-droid.org/repo/com.krawieck.lemmur/en-US/phoneScreenshots/5.png</image>
<image type="source">https://f-droid.org/repo/com.krawieck.lemmur/en-US/phoneScreenshots/6.png</image>
</screenshot>
</screenshots>

<launchable type="desktop-id">com.krawieck.lemmur.desktop</launchable>

<content_rating type="oars-1.1">
<content_attribute id="social-chat">intense</content_attribute>
<content_attribute id="social-info">mild</content_attribute>
<content_attribute id="social-contacts">intense</content_attribute>
</content_rating>
</component>
12 changes: 12 additions & 0 deletions lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:keyboard_dismisser/keyboard_dismisser.dart';

Expand All @@ -7,6 +9,15 @@ import 'resources/theme.dart';
import 'stores/config_store.dart';
import 'util/observer_consumers.dart';

//Fixes scroll behaviour on Linux devices
class TouchScrollBehaviour extends MaterialScrollBehavior {
@override
Set<PointerDeviceKind> get dragDevices => {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
};
}

class MyApp extends StatelessWidget {
const MyApp();

Expand All @@ -22,6 +33,7 @@ class MyApp extends StatelessWidget {
darkTheme: store.amoledDarkMode ? amoledTheme : darkTheme,
locale: store.locale,
theme: lightTheme,
scrollBehavior: TouchScrollBehaviour(),
home: const HomePage(),
),
),
Expand Down
53 changes: 8 additions & 45 deletions lib/util/async_store.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,14 @@ class __$$AsyncStateInitialCopyWithImpl<T, $Res>

/// @nodoc

class _$AsyncStateInitial<T>
with DiagnosticableTreeMixin
implements AsyncStateInitial<T> {
class _$AsyncStateInitial<T> implements AsyncStateInitial<T> {
const _$AsyncStateInitial();

@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
String toString() {
return 'AsyncState<$T>.initial()';
}

@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty('type', 'AsyncState<$T>.initial'));
}

@override
bool operator ==(dynamic other) {
return identical(this, other) ||
Expand Down Expand Up @@ -249,9 +241,7 @@ class __$$AsyncStateDataCopyWithImpl<T, $Res>

/// @nodoc

class _$AsyncStateData<T>
with DiagnosticableTreeMixin
implements AsyncStateData<T> {
class _$AsyncStateData<T> implements AsyncStateData<T> {
const _$AsyncStateData(this.data, [this.errorTerm]);

@override
Expand All @@ -260,19 +250,10 @@ class _$AsyncStateData<T>
final String? errorTerm;

@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
String toString() {
return 'AsyncState<$T>.data(data: $data, errorTerm: $errorTerm)';
}

@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('type', 'AsyncState<$T>.data'))
..add(DiagnosticsProperty('data', data))
..add(DiagnosticsProperty('errorTerm', errorTerm));
}

@override
bool operator ==(dynamic other) {
return identical(this, other) ||
Expand Down Expand Up @@ -400,22 +381,14 @@ class __$$AsyncStateLoadingCopyWithImpl<T, $Res>

/// @nodoc

class _$AsyncStateLoading<T>
with DiagnosticableTreeMixin
implements AsyncStateLoading<T> {
class _$AsyncStateLoading<T> implements AsyncStateLoading<T> {
const _$AsyncStateLoading();

@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
String toString() {
return 'AsyncState<$T>.loading()';
}

@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty('type', 'AsyncState<$T>.loading'));
}

@override
bool operator ==(dynamic other) {
return identical(this, other) ||
Expand Down Expand Up @@ -538,27 +511,17 @@ class __$$AsyncStateErrorCopyWithImpl<T, $Res>

/// @nodoc

class _$AsyncStateError<T>
with DiagnosticableTreeMixin
implements AsyncStateError<T> {
class _$AsyncStateError<T> implements AsyncStateError<T> {
const _$AsyncStateError(this.errorTerm);

@override
final String errorTerm;

@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
String toString() {
return 'AsyncState<$T>.error(errorTerm: $errorTerm)';
}

@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('type', 'AsyncState<$T>.error'))
..add(DiagnosticsProperty('errorTerm', errorTerm));
}

@override
bool operator ==(dynamic other) {
return identical(this, other) ||
Expand Down
4 changes: 4 additions & 0 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@

#include "generated_plugin_registrant.h"

#include <handy_window/handy_window_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) handy_window_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "HandyWindowPlugin");
handy_window_plugin_register_with_registrar(handy_window_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
Expand Down
1 change: 1 addition & 0 deletions linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
handy_window
url_launcher_linux
)

Expand Down
7 changes: 5 additions & 2 deletions linux/my_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,20 @@ static void my_application_activate(GApplication* application) {
}

gtk_window_set_default_size(window, 1280, 720);
gtk_widget_show(GTK_WIDGET(window));


g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);

FlView* view = fl_view_new(project);
gtk_widget_show(GTK_WIDGET(view));

gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));

fl_register_plugins(FL_PLUGIN_REGISTRY(view));

gtk_widget_show(GTK_WIDGET(window));
gtk_widget_show(GTK_WIDGET(view));

gtk_widget_grab_focus(GTK_WIDGET(view));
}

Expand Down
Loading