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