Compare commits

...

3 Commits

Author SHA1 Message Date
Gregory Schier
03a4cd30ca Fix release (#30) 2024-05-14 15:35:53 -07:00
Gregory Schier
40b477ad8b Release 2024.4.1 (#28) 2024-05-14 15:01:55 -07:00
Gregory Schier
4f5dbc0770 Add num launches to notification call 2024-05-14 14:25:10 -07:00
8 changed files with 40 additions and 28 deletions

View File

@@ -1,10 +1,8 @@
name: Generate Artifacts
on:
push:
tags: [ v* ]
permissions: write-all
branches:
- release
jobs:
build-artifacts:
permissions:
@@ -23,20 +21,17 @@ jobs:
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
@@ -44,13 +39,10 @@ jobs:
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -43,6 +43,7 @@
"window:allow-is-fullscreen",
"window:allow-maximize",
"window:allow-minimize",
"window:allow-toggle-maximize",
"window:allow-set-decorations",
"window:allow-set-title",
"window:allow-start-dragging",

View File

@@ -1 +1 @@
{"main":{"identifier":"main","description":"Main permissions","local":true,"windows":["*"],"permissions":["os:allow-os-type","event:allow-emit","clipboard-manager:allow-write-text","clipboard-manager:allow-read-text","dialog:allow-open","dialog:allow-save","event:allow-listen","event:allow-unlisten","fs:allow-read-file","fs:allow-read-text-file",{"identifier":"fs:scope","allow":[{"path":"$APPDATA"},{"path":"$APPDATA/**"}]},"shell:allow-open",{"identifier":"shell:allow-execute","allow":[{"args":true,"name":"protoc","sidecar":true}]},"window:allow-close","window:allow-is-fullscreen","window:allow-maximize","window:allow-minimize","window:allow-set-decorations","window:allow-set-title","window:allow-start-dragging","window:allow-unmaximize","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text"]}}
{"main":{"identifier":"main","description":"Main permissions","local":true,"windows":["*"],"permissions":["os:allow-os-type","event:allow-emit","clipboard-manager:allow-write-text","clipboard-manager:allow-read-text","dialog:allow-open","dialog:allow-save","event:allow-listen","event:allow-unlisten","fs:allow-read-file","fs:allow-read-text-file",{"identifier":"fs:scope","allow":[{"path":"$APPDATA"},{"path":"$APPDATA/**"}]},"shell:allow-open",{"identifier":"shell:allow-execute","allow":[{"args":true,"name":"protoc","sidecar":true}]},"window:allow-close","window:allow-is-fullscreen","window:allow-maximize","window:allow-minimize","window:allow-toggle-maximize","window:allow-set-decorations","window:allow-set-title","window:allow-start-dragging","window:allow-unmaximize","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text"]}}

View File

@@ -11,6 +11,9 @@ use crate::models::{
generate_id, get_key_value_int, get_key_value_string, set_key_value_int, set_key_value_string,
};
const NAMESPACE: &str = "analytics";
const NUM_LAUNCHES_KEY: &str = "num_launches";
// serializable
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "snake_case")]
@@ -93,20 +96,19 @@ pub struct LaunchEventInfo {
pub num_launches: i32,
}
pub async fn track_launch_event(app_handle: &AppHandle) -> LaunchEventInfo {
let namespace = "analytics";
pub async fn track_launch_event(app: &AppHandle) -> LaunchEventInfo {
let last_tracked_version_key = "last_tracked_version";
let mut info = LaunchEventInfo::default();
info.num_launches = get_key_value_int(app_handle, namespace, "num_launches", 0).await + 1;
info.num_launches = get_num_launches(app).await + 1;
info.previous_version =
get_key_value_string(app_handle, namespace, last_tracked_version_key, "").await;
info.current_version = app_handle.package_info().version.to_string();
get_key_value_string(app, NAMESPACE, last_tracked_version_key, "").await;
info.current_version = app.package_info().version.to_string();
if info.previous_version.is_empty() {
track_event(
app_handle,
app,
AnalyticsResource::App,
AnalyticsAction::LaunchFirst,
None,
@@ -116,10 +118,10 @@ pub async fn track_launch_event(app_handle: &AppHandle) -> LaunchEventInfo {
info.launched_after_update = info.current_version != info.previous_version;
if info.launched_after_update {
track_event(
app_handle,
app,
AnalyticsResource::App,
AnalyticsAction::LaunchUpdate,
Some(json!({ "num_launches": info.num_launches })),
Some(json!({ NUM_LAUNCHES_KEY: info.num_launches })),
)
.await;
}
@@ -127,23 +129,23 @@ pub async fn track_launch_event(app_handle: &AppHandle) -> LaunchEventInfo {
// Track a launch event in all cases
track_event(
app_handle,
app,
AnalyticsResource::App,
AnalyticsAction::Launch,
Some(json!({ "num_launches": info.num_launches })),
Some(json!({ NUM_LAUNCHES_KEY: info.num_launches })),
)
.await;
// Update key values
set_key_value_string(
app_handle,
namespace,
app,
NAMESPACE,
last_tracked_version_key,
info.current_version.as_str(),
)
.await;
set_key_value_int(app_handle, namespace, "num_launches", info.num_launches).await;
set_key_value_int(app, NAMESPACE, NUM_LAUNCHES_KEY, info.num_launches).await;
info
}
@@ -242,3 +244,7 @@ async fn get_id(app_handle: &AppHandle) -> String {
id
}
}
pub async fn get_num_launches(app: &AppHandle) -> i32 {
get_key_value_int(app, NAMESPACE, NUM_LAUNCHES_KEY, 0).await
}

View File

@@ -6,6 +6,7 @@ use log::debug;
use serde::{Deserialize, Serialize};
use tauri::{AppHandle, Manager};
use crate::analytics::get_num_launches;
use crate::models::{get_key_value_raw, set_key_value_raw};
// Check for updates every hour
@@ -60,10 +61,14 @@ impl YaakNotifier {
self.last_check = SystemTime::now();
let num_launches = get_num_launches(app).await;
let info = app.package_info().clone();
let req = reqwest::Client::default()
.request(Method::GET, "https://notify.yaak.app/notifications")
.query(&[("version", info.version)]);
.query(&[
("version", info.version.to_string()),
("launches", num_launches.to_string()),
]);
let resp = req.send().await.map_err(|e| e.to_string())?;
let notification = resp
.json::<YaakNotification>()

View File

@@ -53,7 +53,7 @@ impl YaakUpdater {
) -> Result<bool, tauri_plugin_updater::Error> {
self.last_update_check = SystemTime::now();
let enabled = is_dev();
let enabled = !is_dev();
info!("Checking for updates mode={} enabled={}", mode, enabled);
if !enabled {

View File

@@ -6,7 +6,7 @@
"frontendDist": "../dist"
},
"productName": "Yaak",
"version": "2024.4.0",
"version": "2024.4.2",
"identifier": "app.yaak.desktop",
"app": {
"withGlobalTauri": false,

View File

@@ -21,12 +21,20 @@ export function twig(
const completions = twigCompletion({ options: variables });
const language = mixLanguage(base);
const completion = language.data.of({ autocomplete: completions });
const completionBase = base.language.data.of({ autocomplete: completions });
const additionalCompletion = autocomplete
? [base.language.data.of({ autocomplete: genericCompletion(autocomplete) })]
: [];
return [language, completionBase, base.support, placeholders(variables), ...additionalCompletion];
return [
language,
completion,
completionBase,
base.support,
placeholders(variables),
...additionalCompletion,
];
}
function mixLanguage(base: LanguageSupport): LRLanguage {