xref: /MusicFree/src/constants/commonConst.ts (revision 8e47be56b0121ae1a9c00382d70902276ffca225)
1import Animated, {Easing} from 'react-native-reanimated';
2
3export const internalSymbolKey = Symbol.for('$');
4export const internalSerializeKey = '$';
5export const localMusicSheetId = 'local-music-sheet';
6export const musicHistorySheetId = 'history-music-sheet';
7
8export const localPluginPlatform = '本地';
9export const localPluginHash = 'local-plugin-hash';
10
11export const internalFakeSoundKey = 'fake-key';
12
13const emptyFunction = () => {};
14Object.freeze(emptyFunction);
15export {emptyFunction};
16
17export enum RequestStateCode {
18    /** 空闲 */
19    IDLE = 0,
20    /** 检索首页 */
21    PENDING_FP = 1,
22    /** 检索中 */
23    PENDING = 2,
24    /** 部分结束 */
25    PARTLY_DONE = 4,
26    /** 全部结束 */
27    FINISHED = 5,
28}
29
30export const StorageKeys = {
31    MediaMetaKeys: 'media-meta-keys',
32    PluginMetaKey: 'plugin-meta',
33    MediaCache: 'media-cache',
34    LocalMusicSheet: 'local-music-sheet',
35};
36
37export const CacheControl = {
38    Cache: 'cache',
39    NoCache: 'no-cache',
40    NoStore: 'no-store',
41};
42
43export const supportLocalMediaType = [
44    '.mp3',
45    '.flac',
46    '.wma',
47    '.wav',
48    '.m4a',
49    '.ogg',
50    '.acc',
51    '.aac',
52    '.ape',
53    '.opus',
54];
55
56/** 全局事件 */
57export enum EDeviceEvents {
58    /** 刷新歌词 */
59    REFRESH_LYRIC = 'refresh-lyric',
60}
61
62const ANIMATION_EASING: Animated.EasingFunction = Easing.out(Easing.exp);
63const ANIMATION_DURATION = 150;
64
65const animationFast = {
66    duration: ANIMATION_DURATION,
67    easing: ANIMATION_EASING,
68};
69
70const animationNormal = {
71    duration: 250,
72    easing: ANIMATION_EASING,
73};
74
75const animationSlow = {
76    duration: 500,
77    easing: ANIMATION_EASING,
78};
79
80export const timingConfig = {
81    animationFast,
82    animationNormal,
83    animationSlow,
84};
85