mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: set min version number (#5390)
* chore: set min version number * chore: fix test
This commit is contained in:
parent
b2978e0d6c
commit
68c4e19f91
@ -94,6 +94,7 @@ flowy-notification = { path = "../../rust-lib/flowy-notification", features = [
|
||||
uuid = "1.5.0"
|
||||
tauri-plugin-deep-link = "0.1.2"
|
||||
dotenv = "0.15.0"
|
||||
semver = "1.0.23"
|
||||
|
||||
[features]
|
||||
# by default Tauri runs in production mode
|
||||
|
@ -34,7 +34,8 @@ pub fn init_flowy_core() -> AppFlowyCore {
|
||||
.version
|
||||
.clone()
|
||||
.map(|v| v.to_string())
|
||||
.unwrap_or_else(|| "0.0.0".to_string());
|
||||
.unwrap_or_else(|| "0.5.8".to_string());
|
||||
let app_version = semver::Version::parse(&app_version).unwrap_or_else(|_| semver::Version::new(0, 5, 8));
|
||||
let mut data_path = tauri::api::path::app_local_data_dir(&config).unwrap();
|
||||
if cfg!(debug_assertions) {
|
||||
data_path.push("data_dev");
|
||||
|
@ -93,6 +93,7 @@ flowy-notification = { path = "../../rust-lib/flowy-notification", features = [
|
||||
uuid = "1.5.0"
|
||||
tauri-plugin-deep-link = "0.1.2"
|
||||
dotenv = "0.15.0"
|
||||
semver = "1.0.23"
|
||||
|
||||
[features]
|
||||
# by default Tauri runs in production mode
|
||||
|
@ -30,6 +30,7 @@ pub fn init_flowy_core() -> AppFlowyCore {
|
||||
let config: tauri_utils::config::Config = serde_json::from_str(config_json).unwrap();
|
||||
|
||||
let app_version = config.package.version.clone().map(|v| v.to_string()).unwrap_or_else(|| "0.0.0".to_string());
|
||||
let app_version = semver::Version::parse(&app_version).unwrap_or_else(|_| semver::Version::new(0, 5, 8));
|
||||
let mut data_path = tauri::api::path::app_local_data_dir(&config).unwrap();
|
||||
if cfg!(debug_assertions) {
|
||||
data_path.push("data_dev");
|
||||
|
7
frontend/rust-lib/Cargo.lock
generated
7
frontend/rust-lib/Cargo.lock
generated
@ -1218,6 +1218,7 @@ dependencies = [
|
||||
"lib-log",
|
||||
"parking_lot 0.12.1",
|
||||
"protobuf",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
@ -1509,6 +1510,7 @@ dependencies = [
|
||||
"parking_lot 0.12.1",
|
||||
"protobuf",
|
||||
"rand 0.8.5",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"strum",
|
||||
@ -2035,6 +2037,7 @@ dependencies = [
|
||||
"postgrest",
|
||||
"rand 0.8.5",
|
||||
"reqwest",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
@ -4800,9 +4803,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.22"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
|
||||
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
|
@ -25,6 +25,7 @@ lazy_static = "1.4.0"
|
||||
parking_lot.workspace = true
|
||||
tracing.workspace = true
|
||||
lib-log.workspace = true
|
||||
semver = "1.0.22"
|
||||
|
||||
# workspace
|
||||
lib-dispatch = { workspace = true }
|
||||
|
@ -1,11 +1,11 @@
|
||||
#![allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||
|
||||
use allo_isolate::Isolate;
|
||||
use std::sync::Arc;
|
||||
use std::{ffi::CStr, os::raw::c_char};
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use parking_lot::Mutex;
|
||||
use semver::Version;
|
||||
use std::sync::Arc;
|
||||
use std::{ffi::CStr, os::raw::c_char};
|
||||
use tracing::{debug, error, info, trace, warn};
|
||||
|
||||
use flowy_core::config::AppFlowyCoreConfig;
|
||||
@ -67,8 +67,16 @@ pub extern "C" fn init_sdk(_port: i64, data: *mut c_char) -> i64 {
|
||||
let _ = save_appflowy_cloud_config(&configuration.root, &configuration.appflowy_cloud_config);
|
||||
}
|
||||
|
||||
let mut app_version =
|
||||
Version::parse(&configuration.app_version).unwrap_or_else(|_| Version::new(0, 5, 8));
|
||||
|
||||
let min_version = Version::new(0, 5, 8);
|
||||
if app_version < min_version {
|
||||
app_version = min_version;
|
||||
}
|
||||
|
||||
let config = AppFlowyCoreConfig::new(
|
||||
configuration.app_version,
|
||||
app_version,
|
||||
configuration.custom_app_path,
|
||||
configuration.origin_app_path,
|
||||
configuration.device_id,
|
||||
|
@ -24,6 +24,7 @@ flowy-notification = { workspace = true }
|
||||
anyhow.workspace = true
|
||||
flowy-storage = { workspace = true }
|
||||
flowy-search = { workspace = true }
|
||||
semver = "1.0.23"
|
||||
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
@ -10,6 +10,7 @@ use std::time::Duration;
|
||||
|
||||
use nanoid::nanoid;
|
||||
use parking_lot::RwLock;
|
||||
use semver::Version;
|
||||
use tokio::select;
|
||||
use tokio::time::sleep;
|
||||
|
||||
@ -55,7 +56,7 @@ impl EventIntegrationTest {
|
||||
let device_id = uuid::Uuid::new_v4().to_string();
|
||||
|
||||
let config = AppFlowyCoreConfig::new(
|
||||
"".to_string(),
|
||||
Version::new(0, 5, 8),
|
||||
path.clone(),
|
||||
path,
|
||||
device_id,
|
||||
|
@ -2,6 +2,7 @@ use std::fmt;
|
||||
use std::path::Path;
|
||||
|
||||
use base64::Engine;
|
||||
use semver::Version;
|
||||
use tracing::{error, info};
|
||||
|
||||
use flowy_server_pub::af_cloud_config::AFCloudConfiguration;
|
||||
@ -15,7 +16,7 @@ use crate::integrate::log::create_log_filter;
|
||||
#[derive(Clone)]
|
||||
pub struct AppFlowyCoreConfig {
|
||||
/// Different `AppFlowyCoreConfig` instance should have different name
|
||||
pub(crate) app_version: String,
|
||||
pub(crate) app_version: Version,
|
||||
pub name: String,
|
||||
pub(crate) device_id: String,
|
||||
pub platform: String,
|
||||
@ -75,7 +76,7 @@ fn make_user_data_folder(root: &str, url: &str) -> String {
|
||||
|
||||
impl AppFlowyCoreConfig {
|
||||
pub fn new(
|
||||
app_version: String,
|
||||
app_version: Version,
|
||||
custom_application_path: String,
|
||||
application_path: String,
|
||||
device_id: String,
|
||||
|
@ -133,7 +133,7 @@ impl ServerProvider {
|
||||
config,
|
||||
*self.user_enable_sync.read(),
|
||||
self.config.device_id.clone(),
|
||||
&self.config.app_version,
|
||||
self.config.app_version.clone(),
|
||||
self.user.clone(),
|
||||
));
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
use flowy_search::folder::indexer::FolderIndexManagerImpl;
|
||||
use flowy_search::services::manager::SearchManager;
|
||||
use flowy_storage::ObjectStorageService;
|
||||
use semver::Version;
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::time::Duration;
|
||||
use sysinfo::System;
|
||||
@ -106,13 +105,12 @@ impl AppFlowyCore {
|
||||
let task_dispatcher = Arc::new(RwLock::new(task_scheduler));
|
||||
runtime.spawn(TaskRunner::run(task_dispatcher.clone()));
|
||||
|
||||
let app_version = Version::parse(&config.app_version).unwrap_or_else(|_| Version::new(0, 5, 4));
|
||||
let user_config = UserConfig::new(
|
||||
&config.name,
|
||||
&config.storage_path,
|
||||
&config.application_path,
|
||||
&config.device_id,
|
||||
app_version,
|
||||
config.app_version.clone(),
|
||||
);
|
||||
|
||||
let authenticate_user = Arc::new(AuthenticateUser::new(
|
||||
|
@ -48,6 +48,7 @@ tokio-stream = { workspace = true, features = ["sync"] }
|
||||
lib-dispatch = { workspace = true }
|
||||
yrs.workspace = true
|
||||
rand = "0.8.5"
|
||||
semver = "1.0.23"
|
||||
|
||||
[dependencies.client-api]
|
||||
workspace = true
|
||||
|
@ -12,6 +12,7 @@ use client_api::ws::{
|
||||
use client_api::{Client, ClientConfiguration};
|
||||
use flowy_storage::ObjectStorageService;
|
||||
use rand::Rng;
|
||||
use semver::Version;
|
||||
use tokio::select;
|
||||
use tokio::sync::{watch, Mutex};
|
||||
use tokio_stream::wrappers::WatchStream;
|
||||
@ -53,7 +54,7 @@ impl AppFlowyCloudServer {
|
||||
config: AFCloudConfiguration,
|
||||
enable_sync: bool,
|
||||
mut device_id: String,
|
||||
client_version: &str,
|
||||
client_version: Version,
|
||||
user: Arc<dyn ServerUser>,
|
||||
) -> Self {
|
||||
// The device id can't be empty, so we generate a new one if it is.
|
||||
@ -70,7 +71,7 @@ impl AppFlowyCloudServer {
|
||||
ClientConfiguration::default()
|
||||
.with_compression_buffer_size(10240)
|
||||
.with_compression_quality(8),
|
||||
client_version,
|
||||
&client_version.to_string(),
|
||||
);
|
||||
let token_state_rx = api_client.subscribe_token_state();
|
||||
let enable_sync = Arc::new(AtomicBool::new(enable_sync));
|
||||
|
@ -1,4 +1,5 @@
|
||||
use client_api::ClientConfiguration;
|
||||
use semver::Version;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
@ -32,7 +33,7 @@ pub fn af_cloud_server(config: AFCloudConfiguration) -> Arc<AppFlowyCloudServer>
|
||||
config,
|
||||
true,
|
||||
fake_device_id,
|
||||
"0.5.1",
|
||||
Version::new(0, 5, 8),
|
||||
Arc::new(FakeServerUserImpl),
|
||||
))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user