feat: Initial clean release of CHM
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
这个提交包含在:
@@ -0,0 +1,63 @@
|
||||
// Helper functions to reduce the boiler plate of loading and saving profiles on
|
||||
// mobile
|
||||
|
||||
import { Profile, ProfileConfig } from '@joplin/lib/services/profileConfig/types';
|
||||
import { Dispatch } from 'redux';
|
||||
import { loadProfileConfig as libLoadProfileConfig, saveProfileConfig as libSaveProfileConfig } from '@joplin/lib/services/profileConfig/index';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
|
||||
let dispatch_: Dispatch|null = null;
|
||||
export const setDispatch = (dispatch: Dispatch) => {
|
||||
dispatch_ = dispatch;
|
||||
};
|
||||
|
||||
export const getProfilesRootDir = () => {
|
||||
return shim.fsDriver().getAppDirectoryPath();
|
||||
};
|
||||
|
||||
export const getProfilesConfigPath = () => {
|
||||
return `${getProfilesRootDir()}/profiles.json`;
|
||||
};
|
||||
|
||||
export const getResourceDir = (profile: Profile, isSubProfile: boolean) => {
|
||||
if (!isSubProfile) return getProfilesRootDir();
|
||||
return `${getProfilesRootDir()}/resources-${profile.id}`;
|
||||
};
|
||||
|
||||
export const getPluginDataDir = (profile: Profile, isSubProfile: boolean) => {
|
||||
const suffix = isSubProfile ? `-${profile.id}` : '';
|
||||
return `${getProfilesRootDir()}/plugin-data${suffix}`;
|
||||
};
|
||||
|
||||
export const getDatabaseName = (profile: Profile, isSubProfile: boolean) => {
|
||||
const devMode = Setting.value('env') === 'dev';
|
||||
|
||||
// For historical reasons, the database filename is given "-20240127-1"
|
||||
// as a suffix when running in development mode:
|
||||
const suffix = devMode ? '-20240127-1' : '';
|
||||
|
||||
if (!isSubProfile) return `joplin${suffix}.sqlite`;
|
||||
return `joplin-${profile.id}${suffix}.sqlite`;
|
||||
};
|
||||
|
||||
export const loadProfileConfig = async () => {
|
||||
return libLoadProfileConfig(getProfilesConfigPath());
|
||||
};
|
||||
|
||||
export const saveProfileConfig = async (profileConfig: ProfileConfig) => {
|
||||
await libSaveProfileConfig(getProfilesConfigPath(), profileConfig);
|
||||
dispatch_({
|
||||
type: 'PROFILE_CONFIG_SET',
|
||||
value: profileConfig,
|
||||
});
|
||||
};
|
||||
|
||||
export const switchProfile = async (profileId: string) => {
|
||||
const config = await loadProfileConfig();
|
||||
if (config.currentProfileId === profileId) throw new Error('This profile is already active');
|
||||
|
||||
config.currentProfileId = profileId;
|
||||
await saveProfileConfig(config);
|
||||
await shim.restartApp();
|
||||
};
|
||||
在新工单中引用
屏蔽一个用户