From 93e4879501953ef97d5cb57eae1906895a781a24 Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Thu, 7 Sep 2023 19:40:10 -0400 Subject: [PATCH] change some config stuff --- package.json | 4 +- pnpm-lock.yaml | 68 +++---- src-tauri/Cargo.lock | 182 +++++++----------- src-tauri/Cargo.toml | 20 +- src-tauri/gen/android/app/.gitignore | 2 +- src-tauri/gen/android/app/build.gradle.kts | 4 +- .../android/app/src/main/AndroidManifest.xml | 2 +- .../spacebar/app}/MainActivity.kt | 2 +- .../app/src/main/res/values-night/themes.xml | 2 +- .../app/src/main/res/values/strings.xml | 4 +- .../app/src/main/res/values/themes.xml | 2 +- .../spacebar/app}/kotlin/BuildTask.kt | 0 .../spacebar/app}/kotlin/RustPlugin.kt | 0 src-tauri/src/lib.rs | 25 ++- src-tauri/src/main.rs | 2 +- src-tauri/tauri.conf.json | 14 +- src/App.tsx | 3 + src/custom.d.ts | 6 + src/utils/Utils.ts | 1 - 19 files changed, 164 insertions(+), 179 deletions(-) rename src-tauri/gen/android/app/src/main/java/{com/tauri/tauri_app => chat/spacebar/app}/MainActivity.kt (57%) rename src-tauri/gen/android/buildSrc/src/main/java/{com/tauri/tauri_app => chat/spacebar/app}/kotlin/BuildTask.kt (100%) rename src-tauri/gen/android/buildSrc/src/main/java/{com/tauri/tauri_app => chat/spacebar/app}/kotlin/RustPlugin.kt (100%) diff --git a/package.json b/package.json index 44282c2..8e7cbbb 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ }, "devDependencies": { "@craco/craco": "^7.1.0", - "@tauri-apps/cli": "2.0.0-alpha.11", + "@tauri-apps/cli": "2.0.0-alpha.12", "@types/jest": "^27.5.2", "@types/loadable__component": "^5.13.4", "@types/node": "^16.18.28", @@ -67,9 +67,9 @@ "eslint": "^8.45.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.3", + "internal-ip": "^7.0.0", "typescript": "^5.0.2", "vite": "^4.4.5", - "internal-ip": "^7.0.0", "vite-plugin-svgr": "^3.2.0" }, "homepage": "https://spacebar.chat", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2885524..7c8f317 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -149,8 +149,8 @@ devDependencies: specifier: ^7.1.0 version: 7.1.0(@types/node@16.18.50)(postcss@8.4.29)(react-scripts@5.0.1)(typescript@5.2.2) '@tauri-apps/cli': - specifier: 2.0.0-alpha.11 - version: 2.0.0-alpha.11 + specifier: 2.0.0-alpha.12 + version: 2.0.0-alpha.12 '@types/jest': specifier: ^27.5.2 version: 27.5.2 @@ -4064,8 +4064,8 @@ packages: engines: {node: '>= 14.6.0', npm: '>= 6.6.0', yarn: '>= 1.19.1'} dev: false - /@tauri-apps/cli-darwin-arm64@2.0.0-alpha.11: - resolution: {integrity: sha512-SXm5vCO/Rt5JoY9se35jA4zz8iqgA0bgbcM/qVOrTnd1DUFWUP9Tss0g+UExhqEcvUxo/QPfuwk8qVYDH3A7gg==} + /@tauri-apps/cli-darwin-arm64@2.0.0-alpha.12: + resolution: {integrity: sha512-4PVyuhqka4aid/wTgGcuA2kvvXs0KBHzGgWJ3yMqgADW4r65qxZcSoBcY76JUcru/rECTDdQ1baI5MEwR7Q10A==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -4073,8 +4073,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-darwin-x64@2.0.0-alpha.11: - resolution: {integrity: sha512-usboHzRGITRcT4YM6CC7M11EpgO1pormVhOb2OzhkUmt7m0HTwKDswZL7YER5Kx82RaMqXmt8MKF5q14HZqzkg==} + /@tauri-apps/cli-darwin-x64@2.0.0-alpha.12: + resolution: {integrity: sha512-xno8ByVeRowhfTDf2pKI7bIyDchnldnt1dF2/DcXLLTliOjMCLLhBk67doBMMZ6qBq8n/AKPwVl8dUXzP54q5Q==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -4082,8 +4082,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-alpha.11: - resolution: {integrity: sha512-yAcJOpTnijxSmvxwkbRmHNBmFGo0UyA9qunboDaSppQQqlEozGMwQe6yASUpBdjzRaECbygoiiNez9dHOnQfOg==} + /@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-alpha.12: + resolution: {integrity: sha512-BAO3DSna+589lCtx8mjY2vduigihTicAH8F3csHnDptx2wbm5oASEmEZDCR8nMERKFuJmO2STgqZp+wVOZ6QyA==} engines: {node: '>= 10'} cpu: [arm] os: [linux] @@ -4091,8 +4091,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-linux-arm64-gnu@2.0.0-alpha.11: - resolution: {integrity: sha512-tPYRhxZjAKaBcpN5WerHO39PEru9Uql8milTgp+rD+uu5C0cqUTR524YoffuIox38zB4skq7y8sQCT+oivDLkQ==} + /@tauri-apps/cli-linux-arm64-gnu@2.0.0-alpha.12: + resolution: {integrity: sha512-vOHlOXUBrqbTPpY0/G3FSzxEtsdDIuiy426nGsQA76EZiouGUTAlqzQ6V5MxlLsDkU/wzLDMnQNiNh+JEQ7x2Q==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -4100,8 +4100,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-linux-arm64-musl@2.0.0-alpha.11: - resolution: {integrity: sha512-E+FJ9nnaYcsmm88u8GZOmmiHG/3qG4guF/k7r7Y3v5N9I1NFyiEr8hg5WeHBNBZoepHSrtBRQ0Ov2Bq58hqOzg==} + /@tauri-apps/cli-linux-arm64-musl@2.0.0-alpha.12: + resolution: {integrity: sha512-ND372Qv6HsAs+TAGjMOSWax7n4ogT/t6d5Vuh+asLX45zfdfvmLRqEFgdyxEuMFbsYaIdYO8Aa/S1y9yU6A/KA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -4109,8 +4109,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-linux-x64-gnu@2.0.0-alpha.11: - resolution: {integrity: sha512-Rvy/r0HI2RmE+D+0EUAs5xlIa4zMxQ421PTrOY0WmyTHrjxx/M4TX3D4oJnZsKrLjQ3L8OFvV6A632BJnxpAuA==} + /@tauri-apps/cli-linux-x64-gnu@2.0.0-alpha.12: + resolution: {integrity: sha512-/r6R4NkdH+ilAxghNXMLHyPwdkdARl6CUKD9gdQCp3oRbSc6NCgckja/r/57xctn9kC3NFadGbd4X6JxIq4wIg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -4118,8 +4118,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-linux-x64-musl@2.0.0-alpha.11: - resolution: {integrity: sha512-QT1TH+QieJKDT8YOyUKRIdcnMZgeH/vGdkzkmXbKaGURcYEjsh8qHelYzE+2oyWt8VBIJJXV7DcbNX6g4Q+fMA==} + /@tauri-apps/cli-linux-x64-musl@2.0.0-alpha.12: + resolution: {integrity: sha512-qQkrihz3ORt7h4ecIi2Bmgac95TB3kVxPu8Jr9ZhkeNADiW8f8hOkVitrFyfzanCrhYJRUwpX7QqSGSpng6vkg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -4127,8 +4127,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-win32-arm64-msvc@2.0.0-alpha.11: - resolution: {integrity: sha512-ggGRBzdND1lEYlZ31ujeYvVAKZh/vHjnx7Q5Gsi4Bu3e9pSt3sId0G5G2OXH7WyxftaDUzfsLfKknE3cQwX9rA==} + /@tauri-apps/cli-win32-arm64-msvc@2.0.0-alpha.12: + resolution: {integrity: sha512-cl1t9780yMAO0MY+tQaeW1r0YqNjQKyo3C74JOch9WqZD/bRZ0JtWl8oha+xrgXKanbh2VzatQmo6tFYhiPRuw==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -4136,8 +4136,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-win32-ia32-msvc@2.0.0-alpha.11: - resolution: {integrity: sha512-P32D6CvyzVB+5pPDxcKSoIClGB0el5rzaDne8jVS/VR+IidYp1oCP5wAsF9h+ldEsdesAbsbtWaMKS36kxgA2g==} + /@tauri-apps/cli-win32-ia32-msvc@2.0.0-alpha.12: + resolution: {integrity: sha512-t4X5HFP/oY5KM3fvoV6bjKjLD+VUTbXDr+PvH7/TJrroDdlxfHvEp4YtF1ypnJlwFAfoHdXgFQcVxLN0WfrexQ==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] @@ -4145,8 +4145,8 @@ packages: dev: true optional: true - /@tauri-apps/cli-win32-x64-msvc@2.0.0-alpha.11: - resolution: {integrity: sha512-a3geg/sWR7+qfTuoQGFK13YlHlip47XYnMXtoaC+SAXJ7Pur+/m48PZgxYy5mwvI2ApNUTgkMO5ZwdeeK2sh5g==} + /@tauri-apps/cli-win32-x64-msvc@2.0.0-alpha.12: + resolution: {integrity: sha512-LNo60aSDBQtdaptWw5CUmbdL8uzkZeVcGmgFWcD3mmfu70NTYgrIT2PNwGPc5ZlUIKz6GNBI8WSEm3ozp3AkKg==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -4154,21 +4154,21 @@ packages: dev: true optional: true - /@tauri-apps/cli@2.0.0-alpha.11: - resolution: {integrity: sha512-akkxK6lkPyo27F7+GHJuZTEUWwaX5yKRXrDhir+DAzEH4Gt/EZ+GsPFPgSV1EBQzDZGdMGpRovuftIky7m0TZw==} + /@tauri-apps/cli@2.0.0-alpha.12: + resolution: {integrity: sha512-R0FG+dSel4zt5Sra8WlNwclNlZpgxOtDoPFcdezUtUMjmetrwEJGeiUIFMA46IEUV+LCCije5tUvUqEkBlysKg==} engines: {node: '>= 10'} hasBin: true optionalDependencies: - '@tauri-apps/cli-darwin-arm64': 2.0.0-alpha.11 - '@tauri-apps/cli-darwin-x64': 2.0.0-alpha.11 - '@tauri-apps/cli-linux-arm-gnueabihf': 2.0.0-alpha.11 - '@tauri-apps/cli-linux-arm64-gnu': 2.0.0-alpha.11 - '@tauri-apps/cli-linux-arm64-musl': 2.0.0-alpha.11 - '@tauri-apps/cli-linux-x64-gnu': 2.0.0-alpha.11 - '@tauri-apps/cli-linux-x64-musl': 2.0.0-alpha.11 - '@tauri-apps/cli-win32-arm64-msvc': 2.0.0-alpha.11 - '@tauri-apps/cli-win32-ia32-msvc': 2.0.0-alpha.11 - '@tauri-apps/cli-win32-x64-msvc': 2.0.0-alpha.11 + '@tauri-apps/cli-darwin-arm64': 2.0.0-alpha.12 + '@tauri-apps/cli-darwin-x64': 2.0.0-alpha.12 + '@tauri-apps/cli-linux-arm-gnueabihf': 2.0.0-alpha.12 + '@tauri-apps/cli-linux-arm64-gnu': 2.0.0-alpha.12 + '@tauri-apps/cli-linux-arm64-musl': 2.0.0-alpha.12 + '@tauri-apps/cli-linux-x64-gnu': 2.0.0-alpha.12 + '@tauri-apps/cli-linux-x64-musl': 2.0.0-alpha.12 + '@tauri-apps/cli-win32-arm64-msvc': 2.0.0-alpha.12 + '@tauri-apps/cli-win32-ia32-msvc': 2.0.0-alpha.12 + '@tauri-apps/cli-win32-x64-msvc': 2.0.0-alpha.12 dev: true /@tauri-apps/plugin-authenticator@2.0.0-alpha.1: diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 9a48f65..fe757b1 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -62,6 +62,16 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "app" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", + "tauri", + "tauri-build 2.0.0-alpha.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "async-broadcast" version = "0.5.1" @@ -1580,25 +1590,6 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" -[[package]] -name = "is-docker" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" -dependencies = [ - "once_cell", -] - -[[package]] -name = "is-wsl" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" -dependencies = [ - "is-docker", - "once_cell", -] - [[package]] name = "itoa" version = "0.4.8" @@ -2080,17 +2071,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "open" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a083c0c7e5e4a8ec4176346cf61f67ac674e8bfb059d9226e1c54a96b377c12" -dependencies = [ - "is-wsl", - "libc", - "pathdiff", -] - [[package]] name = "ordered-stream" version = "0.2.0" @@ -2101,16 +2081,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "os_pipe" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ae859aa07428ca9a929b936690f8b12dc5f11dd8c6992a18ca93919f28bc177" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "overload" version = "0.1.1" @@ -2172,12 +2142,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "pathdiff" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" - [[package]] name = "percent-encoding" version = "2.3.0" @@ -2890,16 +2854,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shared_child" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "signal-hook" version = "0.3.17" @@ -3162,8 +3116,7 @@ checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" [[package]] name = "tauri" version = "2.0.0-alpha.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee399da0cca87a81e1bf9365321340595a45a24190f20b1aa476b4cd96c3318" +source = "git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url#b4ce5bdb20a617ab2738bf17656ad68cbb3cf4c8" dependencies = [ "anyhow", "bytes", @@ -3193,11 +3146,11 @@ dependencies = [ "serialize-to-javascript", "state", "swift-rs", - "tauri-build", + "tauri-build 2.0.0-alpha.8 (git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url)", "tauri-macros", "tauri-runtime", "tauri-runtime-wry", - "tauri-utils", + "tauri-utils 2.0.0-alpha.7 (git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url)", "thiserror", "tokio", "tray-icon", @@ -3208,18 +3161,6 @@ dependencies = [ "windows", ] -[[package]] -name = "tauri-app" -version = "0.0.0" -dependencies = [ - "serde", - "serde_json", - "tauri", - "tauri-build", - "tauri-plugin-shell", - "tauri-plugin-window", -] - [[package]] name = "tauri-build" version = "2.0.0-alpha.8" @@ -3235,7 +3176,26 @@ dependencies = [ "serde", "serde_json", "swift-rs", - "tauri-utils", + "tauri-utils 2.0.0-alpha.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tauri-winres", + "walkdir", +] + +[[package]] +name = "tauri-build" +version = "2.0.0-alpha.8" +source = "git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url#b4ce5bdb20a617ab2738bf17656ad68cbb3cf4c8" +dependencies = [ + "anyhow", + "cargo_toml", + "heck", + "json-patch", + "plist", + "semver", + "serde", + "serde_json", + "swift-rs", + "tauri-utils 2.0.0-alpha.7 (git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url)", "tauri-winres", "walkdir", ] @@ -3243,8 +3203,7 @@ dependencies = [ [[package]] name = "tauri-codegen" version = "2.0.0-alpha.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f98a67c7ef3cb3c25de91fe1fa16cc3681997f6ec99da0a7496d6feae2ea91e" +source = "git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url#b4ce5bdb20a617ab2738bf17656ad68cbb3cf4c8" dependencies = [ "base64", "brotli", @@ -3258,7 +3217,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "tauri-utils", + "tauri-utils 2.0.0-alpha.7 (git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url)", "thiserror", "time", "url", @@ -3269,51 +3228,20 @@ dependencies = [ [[package]] name = "tauri-macros" version = "2.0.0-alpha.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b01cb5f945c71e040c5d191c32598565ae26cc266a9d5d4f7dd2dc324c5cfdd0" +source = "git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url#b4ce5bdb20a617ab2738bf17656ad68cbb3cf4c8" dependencies = [ "heck", "proc-macro2", "quote", "syn 1.0.109", "tauri-codegen", - "tauri-utils", -] - -[[package]] -name = "tauri-plugin-shell" -version = "2.0.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d21f1f34e003004f3a74402842cd4842dfc13249119e49d4cd9c22e899f099" -dependencies = [ - "encoding_rs", - "log", - "open", - "os_pipe", - "regex", - "serde", - "serde_json", - "shared_child", - "tauri", - "thiserror", -] - -[[package]] -name = "tauri-plugin-window" -version = "2.0.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "646c4d192ac58631b56059b5a3b26b254b42dcae91a455a818a22687bb841c39" -dependencies = [ - "serde", - "tauri", - "thiserror", + "tauri-utils 2.0.0-alpha.7 (git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url)", ] [[package]] name = "tauri-runtime" version = "1.0.0-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525c4dea52547a13e58816c655bd0928f6c30026515e7b2a77166bcd984da6d0" +source = "git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url#b4ce5bdb20a617ab2738bf17656ad68cbb3cf4c8" dependencies = [ "gtk", "http", @@ -3322,7 +3250,7 @@ dependencies = [ "raw-window-handle", "serde", "serde_json", - "tauri-utils", + "tauri-utils 2.0.0-alpha.7 (git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url)", "thiserror", "url", "uuid", @@ -3332,8 +3260,7 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" version = "1.0.0-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79f53914c8ab391c5cd83f0bc269f8dfa6d48cb826d0584b57d396862360dc38" +source = "git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url#b4ce5bdb20a617ab2738bf17656ad68cbb3cf4c8" dependencies = [ "cocoa 0.24.1", "gtk", @@ -3343,7 +3270,7 @@ dependencies = [ "rand 0.8.5", "raw-window-handle", "tauri-runtime", - "tauri-utils", + "tauri-utils 2.0.0-alpha.7 (git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url)", "uuid", "webkit2gtk", "webview2-com", @@ -3356,6 +3283,33 @@ name = "tauri-utils" version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06bcd7c6f67fd6371dcc22da7d7f26ec12c4eae26ad7bc54943bb9f35b5db302" +dependencies = [ + "ctor", + "dunce", + "glob", + "heck", + "html5ever", + "infer", + "json-patch", + "kuchikiki", + "memchr", + "phf 0.10.1", + "proc-macro2", + "quote", + "semver", + "serde", + "serde_json", + "serde_with", + "thiserror", + "url", + "walkdir", + "windows", +] + +[[package]] +name = "tauri-utils" +version = "2.0.0-alpha.7" +source = "git+https://github.com/tauri-apps/tauri.git?branch=fix/windows-custom-protocol-url#b4ce5bdb20a617ab2738bf17656ad68cbb3cf4c8" dependencies = [ "brotli", "ctor", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 43551d8..55bc0f1 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "tauri-app" -version = "0.0.0" -description = "A Tauri App" -authors = ["you"] -license = "" -repository = "" +name = "app" +version = "0.1.0" +description = "Spacebar Client" +authors = ["Puyodead1"] +license = "AGPL-3.0-only" +repository = "https://github.com/spacebarchat/client" edition = "2021" [lib] -name = "tauri_app_lib" +name = "spacebar" crate-type = ["staticlib", "cdylib", "rlib"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -17,9 +17,9 @@ crate-type = ["staticlib", "cdylib", "rlib"] tauri-build = { version = "2.0.0-alpha", features = [] } [dependencies] -tauri = { version = "2.0.0-alpha", features = [] } -tauri-plugin-window = "2.0.0-alpha" -tauri-plugin-shell = "2.0.0-alpha" +# tauri = { version = "2.0.0-alpha", features = [] } +tauri = { git = "https://github.com/tauri-apps/tauri.git", branch = "fix/windows-custom-protocol-url", features = [ +] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/src-tauri/gen/android/app/.gitignore b/src-tauri/gen/android/app/.gitignore index 29984f4..1463fce 100644 --- a/src-tauri/gen/android/app/.gitignore +++ b/src-tauri/gen/android/app/.gitignore @@ -1,4 +1,4 @@ -/src/main/java/com/tauri/tauri_app/generated +/src/main/java/chat/spacebar/app/generated /src/main/jniLibs/**/*.so /src/main/assets/tauri.conf.json /tauri.build.gradle.kts diff --git a/src-tauri/gen/android/app/build.gradle.kts b/src-tauri/gen/android/app/build.gradle.kts index 7c622f4..b9c3b7d 100644 --- a/src-tauri/gen/android/app/build.gradle.kts +++ b/src-tauri/gen/android/app/build.gradle.kts @@ -6,10 +6,10 @@ plugins { android { compileSdk = 33 - namespace = "com.tauri.tauri_app" + namespace = "chat.spacebar.app" defaultConfig { manifestPlaceholders["usesCleartextTraffic"] = "false" - applicationId = "com.tauri.tauri_app" + applicationId = "chat.spacebar.app" minSdk = 24 targetSdk = 33 versionCode = 1 diff --git a/src-tauri/gen/android/app/src/main/AndroidManifest.xml b/src-tauri/gen/android/app/src/main/AndroidManifest.xml index 2f3f41b..b871056 100644 --- a/src-tauri/gen/android/app/src/main/AndroidManifest.xml +++ b/src-tauri/gen/android/app/src/main/AndroidManifest.xml @@ -4,7 +4,7 @@ - diff --git a/src-tauri/gen/android/app/src/main/res/values/strings.xml b/src-tauri/gen/android/app/src/main/res/values/strings.xml index e6c8671..8a3b57d 100644 --- a/src-tauri/gen/android/app/src/main/res/values/strings.xml +++ b/src-tauri/gen/android/app/src/main/res/values/strings.xml @@ -1,4 +1,4 @@ - tauri-app - tauri-app + Spacebar + Spacebar \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/values/themes.xml b/src-tauri/gen/android/app/src/main/res/values/themes.xml index 222f3a7..f49d1a6 100644 --- a/src-tauri/gen/android/app/src/main/res/values/themes.xml +++ b/src-tauri/gen/android/app/src/main/res/values/themes.xml @@ -1,6 +1,6 @@ - diff --git a/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/tauri_app/kotlin/BuildTask.kt b/src-tauri/gen/android/buildSrc/src/main/java/chat/spacebar/app/kotlin/BuildTask.kt similarity index 100% rename from src-tauri/gen/android/buildSrc/src/main/java/com/tauri/tauri_app/kotlin/BuildTask.kt rename to src-tauri/gen/android/buildSrc/src/main/java/chat/spacebar/app/kotlin/BuildTask.kt diff --git a/src-tauri/gen/android/buildSrc/src/main/java/com/tauri/tauri_app/kotlin/RustPlugin.kt b/src-tauri/gen/android/buildSrc/src/main/java/chat/spacebar/app/kotlin/RustPlugin.kt similarity index 100% rename from src-tauri/gen/android/buildSrc/src/main/java/com/tauri/tauri_app/kotlin/RustPlugin.kt rename to src-tauri/gen/android/buildSrc/src/main/java/chat/spacebar/app/kotlin/RustPlugin.kt diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 5f48bdb..6ac1cf6 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,15 +1,28 @@ -// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command +#[cfg(desktop)] +use tauri::Manager; + +#[cfg(desktop)] #[tauri::command] -fn greet(name: &str) -> String { - format!("Hello, {}! You've been greeted from Rust!", name) +async fn close_splashscreen(window: tauri::Window) { + // Close splashscreen + if let Some(splashscreen) = window.get_window("splashscreen") { + splashscreen.close().unwrap(); + } + + // Show main window + window.get_window("main").unwrap().show().unwrap(); +} + +#[cfg(mobile)] +#[tauri::command] +async fn close_splashscreen() { + // just a dummy function for mobile } #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() - .plugin(tauri_plugin_window::init()) - .plugin(tauri_plugin_shell::init()) - .invoke_handler(tauri::generate_handler![greet]) + .invoke_handler(tauri::generate_handler![close_splashscreen]) .run(tauri::generate_context!()) .expect("error while running tauri application"); } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index c684b4d..9aa2433 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -3,5 +3,5 @@ fn main() { #[cfg(desktop)] - tauri_app_lib::run(); + spacebar::run(); } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 1b2ec0d..0feaa77 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "Spacebar", - "version": "0.1.0" + "version": "../package.json" }, "tauri": { "bundle": { @@ -31,7 +31,17 @@ "fullscreen": false, "resizable": true, "title": "Spacebar", - "maximized": true + "maximized": true, + "visible": false, + "label": "main" + }, + { + "width": 400, + "height": 200, + "decorations": false, + "center": true, + "url": "splashscreen.html", + "label": "splashscreen" } ] }, diff --git a/src/App.tsx b/src/App.tsx index 3f51bd5..1416fac 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,6 +6,7 @@ import LoginPage from "./pages/LoginPage"; import NotFoundPage from "./pages/NotFound"; import RegistrationPage from "./pages/RegistrationPage"; +import { invoke } from "@tauri-apps/api"; import { reaction } from "mobx"; import Loader from "./components/Loader"; import OfflineBanner from "./components/banners/OfflineBanner"; @@ -18,6 +19,7 @@ import SwipeTest from "./pages/SwipeTest"; import ChannelPage from "./pages/subpages/ChannelPage"; import { useAppStore } from "./stores/AppStore"; import { Globals } from "./utils/Globals"; +import { isTauri } from "./utils/Utils"; function App() { const app = useAppStore(); @@ -54,6 +56,7 @@ function App() { logger.debug("Loading complete"); app.setAppLoading(false); + if (isTauri) invoke("close_splashscreen"); return dispose; }, []); diff --git a/src/custom.d.ts b/src/custom.d.ts index 2a860ac..251378c 100644 --- a/src/custom.d.ts +++ b/src/custom.d.ts @@ -4,3 +4,9 @@ declare module "*.svg" { const src: string; export default src; } + +declare global { + interface Window { + __TAURI__: boolean; + } +} diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 5c40509..db5bdba 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -78,5 +78,4 @@ export const getFileDetails = (fileOrAttachment: File | APIAttachment) => { }; }; -// @ts-expect-error - Tauri is not defined in the window object export const isTauri = !!window.__TAURI__;