xref: /MusicFree/src/constants/commonConst.ts (revision 268ffae051f9727ffd7aa44d5171e698a9dc4fd2)
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 = 0b00000000,
20    PENDING_FIRST_PAGE = 0b00000010,
21    LOADING = 0b00000010,
22    /** 检索中 */
23    PENDING_REST_PAGE = 0b00000011,
24    /** 部分结束 */
25    PARTLY_DONE = 0b00000100,
26    /** 全部结束 */
27    FINISHED = 0b0001000,
28    /** 出错了 */
29    ERROR = 0b10000000,
30}
31
32export const StorageKeys = {
33    MediaMetaKeys: 'media-meta-keys',
34    PluginMetaKey: 'plugin-meta',
35    MediaCache: 'media-cache',
36    LocalMusicSheet: 'local-music-sheet',
37};
38
39export const CacheControl = {
40    Cache: 'cache',
41    NoCache: 'no-cache',
42    NoStore: 'no-store',
43};
44
45export const supportLocalMediaType = [
46    '.mp3',
47    '.flac',
48    '.wma',
49    '.wav',
50    '.m4a',
51    '.ogg',
52    '.acc',
53    '.aac',
54    '.ape',
55    '.opus',
56];
57
58/** 全局事件 */
59export enum EDeviceEvents {
60    /** 刷新歌词 */
61    REFRESH_LYRIC = 'refresh-lyric',
62}
63
64const ANIMATION_EASING: Animated.EasingFunction = Easing.out(Easing.exp);
65const ANIMATION_DURATION = 150;
66
67const animationFast = {
68    duration: ANIMATION_DURATION,
69    easing: ANIMATION_EASING,
70};
71
72const animationNormal = {
73    duration: 250,
74    easing: ANIMATION_EASING,
75};
76
77const animationSlow = {
78    duration: 500,
79    easing: ANIMATION_EASING,
80};
81
82export const timingConfig = {
83    animationFast,
84    animationNormal,
85    animationSlow,
86};
87