Deep linking wip

Pop up shows but doesn't pull focus on the app and actually doesn't receive events
This commit is contained in:
Arnab Chakraborty
2024-08-15 00:46:27 +03:00
parent c3e1ac2e65
commit ea521095a3
9 changed files with 40 additions and 38 deletions

BIN
Cargo.lock generated
View File

Binary file not shown.

View File

@@ -42,6 +42,7 @@ tauri-plugin-dialog = "=2.0.0-rc.0"
tauri-plugin-os = "=2.0.0-rc.0"
tauri-plugin-shell = "=2.0.0-rc.0"
tauri-plugin-updater = "=2.0.0-rc.0"
tauri-plugin-deep-link = "=2.0.0-rc.0"
tauri-runtime = { version = "=2.0.0-rc.2" }
tauri-utils = { version = "=2.0.0-rc.2" }

View File

@@ -17,6 +17,7 @@
"dialog:allow-open",
"dialog:allow-save",
"dialog:allow-confirm",
"deep-link:default",
"os:allow-os-type",
"core:window:allow-close",
"core:window:allow-create",

View File

@@ -11,7 +11,7 @@ use sd_core::{Node, NodeError};
use sd_fda::DiskAccess;
use serde::{Deserialize, Serialize};
use specta_typescript::Typescript;
use tauri::Emitter;
use tauri::{Emitter, Listener};
use tauri::{async_runtime::block_on, webview::PlatformWebview, AppHandle, Manager, WindowEvent};
use tauri_plugins::{sd_error_plugin, sd_server_plugin};
use tauri_specta::{collect_events, Builder};
@@ -218,6 +218,10 @@ async fn main() -> tauri::Result<()> {
.setup(move |app| {
// We need a the app handle to determine the data directory now.
// This means all the setup code has to be within `setup`, however it doesn't support async so we `block_on`.
app.listen("deep-link://new-url", |url| {
println!("Received deep link: {:?}", url);
});
block_in_place(|| {
block_on(async move {
builder.mount_events(app);

View File

@@ -29,7 +29,9 @@
"transparent": true,
"center": true,
"windowEffects": {
"effects": ["sidebar"],
"effects": [
"sidebar"
],
"state": "followsWindowActiveState",
"radius": 9
}
@@ -41,7 +43,11 @@
},
"bundle": {
"active": true,
"targets": ["deb", "msi", "dmg"],
"targets": [
"deb",
"msi",
"dmg"
],
"publisher": "Spacedrive Technology Inc.",
"copyright": "Spacedrive Technology Inc.",
"category": "Productivity",
@@ -59,14 +65,20 @@
"files": {
"/usr/share/spacedrive/models/yolov8s.onnx": "../../.deps/models/yolov8s.onnx"
},
"depends": ["libc6", "libxdo3", "dbus"]
"depends": [
"libc6",
"libxdo3",
"dbus"
]
}
},
"macOS": {
"minimumSystemVersion": "10.15",
"exceptionDomain": null,
"entitlements": null,
"frameworks": ["../../.deps/Spacedrive.framework"]
"frameworks": [
"../../.deps/Spacedrive.framework"
]
},
"windows": {
"certificateThumbprint": null,
@@ -90,6 +102,14 @@
"endpoints": [
"https://spacedrive.com/api/releases/tauri/{{version}}/{{target}}/{{arch}}"
]
},
"deep-link": {
"mobile": [],
"desktop": {
"schemes": [
"spacedrive"
]
}
}
}
}

View File

@@ -5,7 +5,8 @@
"declarationDir": "dist",
"paths": {
"~/*": ["./src/*"]
}
},
"moduleResolution": "bundler"
},
"include": ["src"],
"references": [

View File

@@ -183,7 +183,7 @@ pub enum NodeConfigVersion {
}
impl ManagedVersion<NodeConfigVersion> for NodeConfig {
const LATEST_VERSION: NodeConfigVersion = NodeConfigVersion::V4;
const LATEST_VERSION: NodeConfigVersion = NodeConfigVersion::V5;
const KIND: Kind = Kind::Json("version");
type MigrationError = NodeConfigError;

View File

@@ -171,7 +171,7 @@ export default () => {
>
<ExplorerBehaviorSelect />
</Setting>
<FeatureFlagSelector />
{/* <FeatureFlagSelector /> */}
<InvalidateDebugPanel />
{/* <TestNotifications /> */}
<Button size="sm" variant="gray" onClick={() => navigate('./debug/cache')}>

View File

@@ -3,7 +3,6 @@
export type Procedures = {
queries:
{ key: "auth.me", input: never, result: { id: string; email: string } } |
{ key: "backups.getAll", input: never, result: GetAll } |
{ key: "buildInfo", input: never, result: BuildInfo } |
{ key: "cloud.devices.get", input: never, result: MockDevice } |
@@ -12,9 +11,7 @@ export type Procedures = {
{ key: "cloud.libraries.list", input: LibraryListRequest, result: Library[] } |
{ key: "cloud.library.get", input: LibraryArgs<null>, result: null } |
{ key: "cloud.library.list", input: never, result: null } |
{ key: "cloud.locations.list", input: never, result: Core_CloudLocation[] } |
{ key: "cloud.new_locations.get", input: LocationGetRequest, result: CloudLocation } |
{ key: "cloud.new_locations.list", input: LocationListRequest, result: CloudLocation[] } |
{ key: "cloud.locations.list", input: LocationListRequest, result: CloudLocation[] } |
{ key: "ephemeralFiles.getMediaData", input: string, result: MediaData | null } |
{ key: "files.get", input: LibraryArgs<number>, result: ObjectWithFilePaths2 | null } |
{ key: "files.getConvertibleImageExtensions", input: never, result: string[] } |
@@ -63,11 +60,9 @@ export type Procedures = {
{ key: "volumes.list", input: never, result: Volume[] },
mutations:
{ key: "api.sendFeedback", input: Feedback, result: null } |
{ key: "auth.logout", input: never, result: null } |
{ key: "backups.backup", input: LibraryArgs<null>, result: string } |
{ key: "backups.delete", input: string, result: null } |
{ key: "backups.restore", input: string, result: null } |
{ key: "cloud.bootstrap", input: AccessToken, result: null } |
{ key: "cloud.devices.delete", input: DeviceDeleteRequest, result: null } |
{ key: "cloud.devices.update", input: DeviceUpdateRequest, result: null } |
{ key: "cloud.libraries.create", input: LibraryArgs<LibrariesCreateArgs>, result: null } |
@@ -76,11 +71,8 @@ export type Procedures = {
{ key: "cloud.library.create", input: LibraryArgs<null>, result: null } |
{ key: "cloud.library.join", input: string, result: null } |
{ key: "cloud.library.sync", input: LibraryArgs<null>, result: null } |
{ key: "cloud.locations.create", input: string, result: Core_CloudLocation } |
{ key: "cloud.locations.remove", input: string, result: Core_CloudLocation } |
{ key: "cloud.new_locations.create", input: LocationCreateRequest, result: null } |
{ key: "cloud.new_locations.delete", input: LocationDeleteRequest, result: null } |
{ key: "cloud.new_locations.update", input: LocationUpdateRequest, result: null } |
{ key: "cloud.locations.create", input: LocationCreateRequest, result: null } |
{ key: "cloud.locations.delete", input: LocationDeleteRequest, result: null } |
{ key: "ephemeralFiles.copyFiles", input: LibraryArgs<EphemeralFileSystemOps>, result: null } |
{ key: "ephemeralFiles.createFile", input: LibraryArgs<CreateEphemeralFileArgs>, result: string } |
{ key: "ephemeralFiles.createFolder", input: LibraryArgs<CreateEphemeralFolderArgs>, result: string } |
@@ -140,10 +132,8 @@ export type Procedures = {
{ key: "tags.assign", input: LibraryArgs<{ targets: Target[]; tag_id: number; unassign: boolean }>, result: null } |
{ key: "tags.create", input: LibraryArgs<TagCreateArgs>, result: Tag } |
{ key: "tags.delete", input: LibraryArgs<number>, result: null } |
{ key: "tags.update", input: LibraryArgs<TagUpdateArgs>, result: null } |
{ key: "toggleFeatureFlag", input: BackendFeature, result: null },
{ key: "tags.update", input: LibraryArgs<TagUpdateArgs>, result: null },
subscriptions:
{ key: "auth.loginSession", input: never, result: Response } |
{ key: "invalidation.listen", input: never, result: InvalidateOperationEvent[] } |
{ key: "jobs.newFilePathIdentified", input: LibraryArgs<null>, result: number[] } |
{ key: "jobs.newThumbnail", input: LibraryArgs<null>, result: ThumbKey } |
@@ -168,13 +158,6 @@ export type Args = { search?: string | null; filters?: string | null; name?: str
export type AudioProps = { delay: number; padding: number; sample_rate: number | null; sample_format: string | null; bit_per_sample: number | null; channel_layout: string | null }
/**
* All of the feature flags provided by the core itself. The frontend has it's own set of feature flags!
*
* If you want a variant of this to show up on the frontend it must be added to `backendFeatures` in `useFeatureFlag.tsx`
*/
export type BackendFeature = "cloudSync"
export type Backup = ({ id: string; timestamp: string; library_id: string; library_name: string }) & { path: string }
export type BuildInfo = { version: string; commit: string }
@@ -225,8 +208,6 @@ export type ConvertImageArgs = { location_id: number; file_path_id: number; dele
export type ConvertibleExtension = "bmp" | "dib" | "ff" | "gif" | "ico" | "jpg" | "jpeg" | "png" | "pnm" | "qoi" | "tga" | "icb" | "vda" | "vst" | "tiff" | "tif" | "hif" | "heif" | "heifs" | "heic" | "heics" | "avif" | "avci" | "avcs" | "svg" | "svgz" | "pdf" | "webp"
export type Core_CloudLocation = { id: string; name: string }
export type CreateEphemeralFileArgs = { path: string; context: EphemeralFileCreateContextTypes; name: string | null }
export type CreateEphemeralFolderArgs = { path: string; name: string | null }
@@ -483,8 +464,6 @@ export type LocationCreateRequest = { access_token: AccessToken; pub_id: Locatio
export type LocationDeleteRequest = { access_token: AccessToken; pub_id: LocationPubId }
export type LocationGetRequest = { access_token: AccessToken; pub_id: LocationPubId; with_library: boolean; with_device: boolean }
export type LocationListRequest = { access_token: AccessToken; with_library: boolean; with_device: boolean }
export type LocationPubId = string
@@ -501,8 +480,6 @@ export type LocationSettings = { explorer: ExplorerSettings<FilePathOrder> }
*/
export type LocationUpdateArgs = { id: number; name: string | null; generate_preview_media: boolean | null; sync_preview_media: boolean | null; hidden: boolean | null; indexer_rules_ids: number[]; path: string | null }
export type LocationUpdateRequest = { access_token: AccessToken; pub_id: LocationPubId; name: string }
export type LocationWithIndexerRule = { id: number; pub_id: number[]; name: string | null; path: string | null; total_capacity: number | null; available_capacity: number | null; size_in_bytes: number[] | null; is_archived: boolean | null; generate_preview_media: boolean | null; sync_preview_media: boolean | null; hidden: boolean | null; date_created: string | null; instance_id: number | null; indexer_rules: IndexerRule[] }
export type MaybeUndefined<T> = null | T
@@ -544,7 +521,7 @@ id: string;
/**
* name is the display name of the current node. This is set by the user and is shown in the UI. // TODO: Length validation so it can fit in DNS record
*/
name: string; identity: RemoteIdentity; p2p: NodeConfigP2P; features: BackendFeature[]; preferences: NodePreferences; image_labeler_version: string | null }) & { data_path: string; device_model: string | null; is_in_docker: boolean }
name: string; identity: RemoteIdentity; p2p: NodeConfigP2P; preferences: NodePreferences }) & { data_path: string; device_model: string | null; is_in_docker: boolean }
export type NonCriticalError = { indexer: NonCriticalIndexerError } | { file_identifier: NonCriticalFileIdentifierError } | { media_processor: NonCriticalMediaProcessorError }
@@ -649,8 +626,6 @@ export type RescanArgs = { location_id: number; sub_path: string }
export type Resolution = { width: number; height: number }
export type Response = { Start: { user_code: string; verification_url: string; verification_url_complete: string } } | "Complete" | { Error: string }
export type RuleKind = "AcceptFilesByGlob" | "RejectFilesByGlob" | "AcceptIfChildrenDirectoriesArePresent" | "RejectIfChildrenDirectoriesArePresent" | "IgnoredByGit"
export type SavedSearch = { id: number; pub_id: number[]; target: string | null; search: string | null; filters: string | null; name: string | null; icon: string | null; description: string | null; date_created: string | null; date_modified: string | null }