Skip to content

Commit 0b0f956

Browse files
authored
Merge pull request #1 from RussellGN/testing
splash screen removal and log persistence
2 parents 4253c29 + 5955bcb commit 0b0f956

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+299
-187
lines changed

.github/workflows/test_build.yaml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: "Test Build"
2+
3+
on:
4+
push:
5+
branches:
6+
- testing
7+
env:
8+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
9+
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
10+
PROCEED_TO_AUTH_URI: ${{ secrets.PROCEED_TO_AUTH_URI }}
11+
FINNISH_AUTH_URI: ${{ secrets.FINNISH_AUTH_URI }}
12+
13+
jobs:
14+
test-tauri:
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- platform: "macos-latest"
20+
args: "--target aarch64-apple-darwin"
21+
- platform: "macos-latest"
22+
args: "--target x86_64-apple-darwin"
23+
- platform: "ubuntu-22.04"
24+
args: ""
25+
- platform: "windows-latest"
26+
args: ""
27+
28+
runs-on: ${{ matrix.platform }}
29+
defaults:
30+
run:
31+
shell: "bash"
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: install dependencies (ubuntu only)
36+
if: matrix.platform == 'ubuntu-22.04'
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
40+
41+
- name: install Rust stable
42+
uses: dtolnay/rust-toolchain@stable
43+
with:
44+
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
45+
46+
- name: Install pnpm
47+
uses: pnpm/action-setup@v4
48+
with:
49+
version: latest
50+
51+
- name: Setup Node.js
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: lts/*
55+
cache: "pnpm"
56+
57+
- name: install frontend dependencies
58+
run: pnpm install
59+
60+
- name: Cache Rust build
61+
uses: swatinem/rust-cache@v2
62+
with:
63+
workspaces: "./src-tauri -> target"
64+
65+
- name: Create .env file for Vite
66+
run: |
67+
echo VITE_CLIENT_ID=${{secrets.CLIENT_ID }} >> .env
68+
echo VITE_CLIENT_SECRET=${{secrets.CLIENT_SECRET }} >> .env
69+
echo VITE_PROCEED_TO_AUTH_URI=${{secrets.PROCEED_TO_AUTH_URI }} >> .env
70+
echo VITE_FINNISH_AUTH_URI=${{secrets.FINNISH_AUTH_URI }} >> .env
71+
72+
- name: Create .env file for Tauri
73+
run: |
74+
echo CLIENT_ID=${{ secrets.CLIENT_ID }} >> ./src-tauri/.env
75+
echo CLIENT_SECRET=${{ secrets.CLIENT_SECRET }} >> ./src-tauri/.env
76+
77+
# If tagName and releaseId are omitted tauri-action will only build the app and won't try to upload any assets.
78+
- uses: tauri-apps/tauri-action@v0
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
with:
82+
args: ${{ matrix.args }}
83+
84+
- name: Upload build artifacts
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: build-${{ matrix.platform }}
88+
path: |
89+
src-tauri/target/release/**

TODO-UI.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

splashscreen.html

Lines changed: 0 additions & 27 deletions
This file was deleted.

src-tauri/Cargo.lock

Lines changed: 36 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ futures-util = "0.3.31"
3232
colored = "3.0.0"
3333
uuid = { version = "1.16.0", features = ["v4"] }
3434
urlencoding = "2.1.3"
35+
tokio = { version = "1.47.1", features = ["full"] }
3536

3637
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\"))".dependencies]
3738
tauri-plugin-single-instance = { version = "2.3.0", features = ["deep-link"] }

src-tauri/capabilities/default.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,5 @@
33
"identifier": "default",
44
"description": "Capability for the main window",
55
"windows": ["main"],
6-
"permissions": [
7-
"core:default",
8-
"opener:default",
9-
"store:default",
10-
"deep-link:default",
11-
"http:default",
12-
"store:allow-load"
13-
]
6+
"permissions": ["core:default", "opener:default", "store:default", "deep-link:default", "http:default"]
147
}

src-tauri/src/commands.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,18 @@ use tauri::{AppHandle, Emitter, Manager, Runtime};
77

88
use crate::{
99
log,
10+
logging::Log,
1011
new_github_api::GithubAPI,
1112
project::{
1213
task::{DraftTask, NewDraftTaskPayload, NewTaskPayload, Task},
1314
Project, ProjectPatchArgs, ProjectPayload,
1415
},
15-
utils::{dbg_store, get_store, get_token, IssueExt},
16+
utils::{dbg_store, get_logs_store, get_store, get_token, IssueExt},
1617
};
1718

1819
#[tauri::command]
19-
pub async fn hide_splash<R: Runtime>(app: AppHandle<R>) -> crate::Result {
20-
if let Some(splashscreen) = app.get_webview_window("splashscreen") {
21-
let _ = splashscreen.close();
22-
}
23-
app.get_webview_window("main")
24-
.expect("could not access main window")
25-
.show()
26-
.expect("could not display main window");
27-
28-
Ok(())
20+
pub async fn persist_log<R: Runtime>(app: AppHandle<R>, log: Log) {
21+
log.persist(get_logs_store(app).ok().as_ref()).await
2922
}
3023

3124
#[tauri::command]

src-tauri/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ mod auth;
22
mod commands;
33
mod experimental;
44
mod github_api;
5+
mod logging;
56
mod new_github_api;
67
mod project;
78
mod setup;
@@ -10,6 +11,7 @@ mod utils;
1011
use setup::init_tauri_plugin_single_instance;
1112

1213
pub const STORE_PATH: &str = "store.json";
14+
pub const LOGS_STORE_PATH: &str = "task_bridge_logs.json";
1315
pub const ENV_STR: &'static str = include_str!("../.env");
1416
pub const TEAM_LOGINS_SEPERATOR: &str = "-;;-";
1517

@@ -18,14 +20,13 @@ pub type Result<T = ()> = std::result::Result<T, String>;
1820
#[cfg_attr(mobile, tauri::mobile_entry_point)]
1921
pub fn run() {
2022
tauri::Builder::default()
21-
// .plugin(tauri_plugin_single_instance::init(init_tauri_plugin_single_instance))
23+
.plugin(tauri_plugin_single_instance::init(init_tauri_plugin_single_instance))
2224
.plugin(tauri_plugin_deep_link::init())
2325
.plugin(tauri_plugin_store::Builder::new().build())
2426
.plugin(tauri_plugin_opener::init())
2527
.plugin(tauri_plugin_http::init())
2628
.setup(setup::setup)
2729
.invoke_handler(tauri::generate_handler![
28-
commands::hide_splash,
2930
commands::fetch_save_and_return_user,
3031
commands::find_users_matching_query,
3132
commands::create_project,
@@ -46,6 +47,7 @@ pub fn run() {
4647
commands::update_project_team,
4748
commands::update_general_project_metadata,
4849
commands::sync_projects_with_github_v2,
50+
commands::persist_log,
4951
experimental::clear_store,
5052
])
5153
.run(tauri::generate_context!())

src-tauri/src/logging.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
use std::sync::Arc;
2+
3+
use serde::{Deserialize, Serialize};
4+
use tauri::Runtime;
5+
use tauri_plugin_store::Store;
6+
7+
use crate::utils::new_id;
8+
9+
#[derive(Deserialize, Serialize)]
10+
pub struct Log {
11+
log_type: String,
12+
title: String,
13+
body: Option<String>,
14+
context: Option<String>,
15+
}
16+
17+
impl Log {
18+
pub async fn persist<R: Runtime>(self, logs_store: Option<&Arc<Store<R>>>) {
19+
if let Some(logs_store) = logs_store {
20+
self.persist_to_logs_store(logs_store)
21+
}
22+
}
23+
24+
fn generate_id(&self) -> String {
25+
format!(
26+
"{}__{}__{}",
27+
chrono::Utc::now().timestamp_micros(),
28+
self.log_type,
29+
new_id()
30+
)
31+
}
32+
33+
fn persist_to_logs_store<R: Runtime>(self, logs_store: &Arc<Store<R>>) {
34+
let id = self.generate_id();
35+
36+
if let Ok(val) = serde_json::to_value(self) {
37+
logs_store.set(id, val);
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)