feat: support deeplink on Linux

This commit is contained in:
Lucas.Xu 2023-08-14 21:38:30 +07:00
parent de4f47b2a1
commit 7f7fd4958f
8 changed files with 79 additions and 28 deletions

View File

@ -32,11 +32,6 @@ class InitSupabaseTask extends LaunchTask {
return; return;
} }
// register deep link for Windows
if (Platform.isWindows) {
registerProtocolHandler(appflowyDeepLinkSchema);
}
supabase?.dispose(); supabase?.dispose();
supabase = null; supabase = null;
final initializedSupabase = await Supabase.initialize( final initializedSupabase = await Supabase.initialize(
@ -47,6 +42,19 @@ class InitSupabaseTask extends LaunchTask {
); );
realtimeService = SupbaseRealtimeService(supabase: initializedSupabase); realtimeService = SupbaseRealtimeService(supabase: initializedSupabase);
supabase = initializedSupabase; supabase = initializedSupabase;
if (Platform.isWindows) {
// register deep link for Windows
registerProtocolHandler(appflowyDeepLinkSchema);
} else if (Platform.isLinux) {
// register deep link for Linux
await SupabaseAuth.instance.registerDBusService(
// these values should be compatible with the values in the desktop file
// dbus-interface.xml
'/io/appflowy/AppFlowy/Object',
'io.appflowy.AppFlowy',
);
}
} }
} }

View File

@ -26,12 +26,13 @@ packages:
source: hosted source: hosted
version: "2.0.7" version: "2.0.7"
app_links: app_links:
dependency: transitive dependency: "direct overridden"
description: description:
name: app_links path: "."
sha256: "16725e716afd0634a5441654b1dda2b6c5557aa230884b5e1f41a5aa546a4cb6" ref: f897e1d
url: "https://pub.dev" resolved-ref: f897e1d81a3d9fcea632588479bc2814d493f7b5
source: hosted url: "https://github.com/LucasXu0/app_links"
source: git
version: "3.4.3" version: "3.4.3"
appflowy_backend: appflowy_backend:
dependency: "direct main" dependency: "direct main"
@ -615,10 +616,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: gotrue name: gotrue
sha256: "214d5050a68ce68a55da1a6d9d7a2e07e039b359f99f1a17ec685320c9101aa6" sha256: "6ba95e38c06af30d4a365112b433567df70f83d5853923274cb894ea9702c5fa"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.8.4" version: "1.11.2"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:
@ -1036,10 +1037,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: postgrest name: postgrest
sha256: "78fd180ecd2274df7b04c406746495b5c627248856458f8f537bf5348de9c817" sha256: d6cc0f60c7dc761f84d1c6d11d9e02b3ad90399bd84639a28c1c024adbaa9bde
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.2" version: "1.5.0"
process: process:
dependency: transitive dependency: transitive
description: description:
@ -1084,10 +1085,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: realtime_client name: realtime_client
sha256: "0342f73f42345f3547e3cdcc804a0ed108fcd9142d1537d159aead94a213e248" sha256: ff743de9bb0f46fcfffcfe64ae93062702dcd0f83a2ce8adc40d5fb7f542af90
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.1" version: "1.1.3"
reorderables: reorderables:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1409,18 +1410,19 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: supabase name: supabase
sha256: "5f5e47fcac99a496e15274d5f6944e1323519df9f8929b4ab9eef8711abeb5f3" sha256: "291e065aa8c9be06a0348743c184beafd038e109960bc3da201affd3eda811fc"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.9.4" version: "1.10.0"
supabase_flutter: supabase_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
name: supabase_flutter path: "packages/supabase_flutter"
sha256: "1ebe89b83b992123d40dcf5aa88b87d6c2d0a3c62052380cfc94de2337aac469" ref: e882842
url: "https://pub.dev" resolved-ref: e8828421720896c0e1600de18f0db54f9f96a3b3
source: hosted url: "https://github.com/LucasXu0/supabase-flutter"
version: "1.10.4" source: git
version: "1.10.12"
sync_http: sync_http:
dependency: transitive dependency: transitive
description: description:
@ -1521,10 +1523,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: universal_io name: universal_io
sha256: "06866290206d196064fd61df4c7aea1ffe9a4e7c4ccaa8fcded42dd41948005d" sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.0" version: "2.2.2"
universal_platform: universal_platform:
dependency: transitive dependency: transitive
description: description:

View File

@ -105,9 +105,6 @@ dependencies:
envied: ^0.3.0+3 envied: ^0.3.0+3
dotted_border: ^2.0.0+3 dotted_border: ^2.0.0+3
url_protocol: url_protocol:
git:
url: https://github.com/LucasXu0/flutter_url_protocol.git
commit: 77a8420
hive: ^2.2.3 hive: ^2.2.3
hive_flutter: ^1.1.0 hive_flutter: ^1.1.0
@ -130,6 +127,20 @@ dev_dependencies:
dependency_overrides: dependency_overrides:
http: ^1.0.0 http: ^1.0.0
supabase_flutter:
git:
url: https://github.com/LucasXu0/supabase-flutter
ref: e882842
path: packages/supabase_flutter
app_links:
git:
url: https://github.com/LucasXu0/app_links
ref: f897e1d
url_protocol:
git:
url: https://github.com/LucasXu0/flutter_url_protocol.git
commit: 77a8420
# The "flutter_lints" package below contains a set of recommended lints to # The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is # encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your # activated in the `analysis_options.yaml` file located at the root of your

View File

@ -0,0 +1,16 @@
<node name="/io/appflowy/AppFlowy/Object">
<interface name="io.appflowy.AppFlowy">
<method name="Activate">
<arg type="a{sv}" name="platform_data" direction="in" />
</method>
<method name="Open">
<arg type="as" name="uris" direction="in" />
<arg type="a{sv}" name="platform_data" direction="in" />
</method>
<method name="ActivateAction">
<arg type="s" name="action_name" direction="in" />
<arg type="av" name="parameter" direction="in" />
<arg type="a{sv}" name="platform_data" direction="in" />
</method>
</interface>
</node>

View File

@ -5,3 +5,5 @@ Icon=io.appflowy.AppFlowy
Exec=env GDK_GL=gles AppFlowy %U Exec=env GDK_GL=gles AppFlowy %U
Categories=Network;Productivity; Categories=Network;Productivity;
Keywords=Notes Keywords=Notes
DBusActivatable=true
Implements=io.appflowy.Appflowy;

View File

@ -0,0 +1,5 @@
[Desktop Entry]
Type=Application
Name=AppFlowy Launcher
Exec=launcher.sh %u
MimeType=x-scheme-handler/appflowy-flutter;

View File

@ -0,0 +1,3 @@
[D-BUS Service]
Name=io.appflowy.AppFlowy
Exec=AppFlowy

View File

@ -0,0 +1,4 @@
#!/bin/bash
gdbus call --session --dest io.appflowy.AppFlowy \
--object-path /io/appflowy/AppFlowy/Object \
--method io.appflowy.AppFlowy.Open "['$1']" {}