Quellcode durchsuchen

feat: support deeplink on Linux

Lucas.Xu vor 1 Jahr
Ursprung
Commit
7f7fd4958f

+ 13 - 5
frontend/appflowy_flutter/lib/startup/tasks/supabase_task.dart

@@ -32,11 +32,6 @@ class InitSupabaseTask extends LaunchTask {
       return;
     }
 
-    // register deep link for Windows
-    if (Platform.isWindows) {
-      registerProtocolHandler(appflowyDeepLinkSchema);
-    }
-
     supabase?.dispose();
     supabase = null;
     final initializedSupabase = await Supabase.initialize(
@@ -47,6 +42,19 @@ class InitSupabaseTask extends LaunchTask {
     );
     realtimeService = SupbaseRealtimeService(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',
+      );
+    }
   }
 }
 

+ 22 - 20
frontend/appflowy_flutter/pubspec.lock

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

+ 14 - 3
frontend/appflowy_flutter/pubspec.yaml

@@ -105,9 +105,6 @@ dependencies:
   envied: ^0.3.0+3
   dotted_border: ^2.0.0+3
   url_protocol:
-    git:
-      url: https://github.com/LucasXu0/flutter_url_protocol.git
-      commit: 77a8420
   hive: ^2.2.3
   hive_flutter: ^1.1.0
 
@@ -130,6 +127,20 @@ dev_dependencies:
 dependency_overrides:
   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
   # 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

+ 16 - 0
frontend/scripts/flatpack-buildfiles/dbus-interface.xml

@@ -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>

+ 2 - 0
frontend/scripts/flatpack-buildfiles/io.appflowy.AppFlowy.desktop

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

+ 5 - 0
frontend/scripts/flatpack-buildfiles/io.appflowy.AppFlowy.launcher.desktop

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

+ 3 - 0
frontend/scripts/flatpack-buildfiles/io.appflowy.AppFlowy.service

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

+ 4 - 0
frontend/scripts/flatpack-buildfiles/launcher.sh

@@ -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']" {}